test_core.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:radar 作者: amoose136 项目源码 文件源码
def test_sort_flexible(self):
        # Test sort on flexible dtype.
        a = array(
            data=[(3, 3), (3, 2), (2, 2), (2, 1), (1, 0), (1, 1), (1, 2)],
            mask=[(0, 0), (0, 1), (0, 0), (0, 0), (1, 0), (0, 0), (0, 0)],
            dtype=[('A', int), ('B', int)])

        test = sort(a)
        b = array(
            data=[(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (3, 2), (1, 0)],
            mask=[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (1, 0)],
            dtype=[('A', int), ('B', int)])
        assert_equal(test, b)
        assert_equal(test.mask, b.mask)

        test = sort(a, endwith=False)
        b = array(
            data=[(1, 0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 2), (3, 3), ],
            mask=[(1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 1), (0, 0), ],
            dtype=[('A', int), ('B', int)])
        assert_equal(test, b)
        assert_equal(test.mask, b.mask)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号