(self)
| 4945 | assert_(c.flags['C']) |
| 4946 | |
| 4947 | def test_make_mask_descr(self): |
| 4948 | # Flexible |
| 4949 | ntype = [('a', float), ('b', float)] |
| 4950 | test = make_mask_descr(ntype) |
| 4951 | assert_equal(test, [('a', bool), ('b', bool)]) |
| 4952 | assert_(test is make_mask_descr(test)) |
| 4953 | |
| 4954 | # Standard w/ shape |
| 4955 | ntype = (float, 2) |
| 4956 | test = make_mask_descr(ntype) |
| 4957 | assert_equal(test, (bool, 2)) |
| 4958 | assert_(test is make_mask_descr(test)) |
| 4959 | |
| 4960 | # Standard standard |
| 4961 | ntype = float |
| 4962 | test = make_mask_descr(ntype) |
| 4963 | assert_equal(test, np.dtype(bool)) |
| 4964 | assert_(test is make_mask_descr(test)) |
| 4965 | |
| 4966 | # Nested |
| 4967 | ntype = [('a', float), ('b', [('ba', float), ('bb', float)])] |
| 4968 | test = make_mask_descr(ntype) |
| 4969 | control = np.dtype([('a', 'b1'), ('b', [('ba', 'b1'), ('bb', 'b1')])]) |
| 4970 | assert_equal(test, control) |
| 4971 | assert_(test is make_mask_descr(test)) |
| 4972 | |
| 4973 | # Named+ shape |
| 4974 | ntype = [('a', (float, 2))] |
| 4975 | test = make_mask_descr(ntype) |
| 4976 | assert_equal(test, np.dtype([('a', (bool, 2))])) |
| 4977 | assert_(test is make_mask_descr(test)) |
| 4978 | |
| 4979 | # 2 names |
| 4980 | ntype = [(('A', 'a'), float)] |
| 4981 | test = make_mask_descr(ntype) |
| 4982 | assert_equal(test, np.dtype([(('A', 'a'), bool)])) |
| 4983 | assert_(test is make_mask_descr(test)) |
| 4984 | |
| 4985 | # nested boolean types should preserve identity |
| 4986 | base_type = np.dtype([('a', int, 3)]) |
| 4987 | base_mtype = make_mask_descr(base_type) |
| 4988 | sub_type = np.dtype([('a', int), ('b', base_mtype)]) |
| 4989 | test = make_mask_descr(sub_type) |
| 4990 | assert_equal(test, np.dtype([('a', bool), ('b', [('a', bool, 3)])])) |
| 4991 | assert_(test.fields['b'][0] is base_mtype) |
| 4992 | |
| 4993 | def test_make_mask(self): |
| 4994 | # Test make_mask |
nothing calls this directly
no test coverage detected