(self)
| 411 | assert_equal_records(fromarrays(_x, dtype=mrec.dtype), mrec[0]) |
| 412 | |
| 413 | def test_fromrecords(self): |
| 414 | # Test construction from records. |
| 415 | (mrec, nrec, ddtype) = self.data |
| 416 | # ...... |
| 417 | palist = [(1, 'abc', 3.7000002861022949, 0), |
| 418 | (2, 'xy', 6.6999998092651367, 1), |
| 419 | (0, ' ', 0.40000000596046448, 0)] |
| 420 | pa = recfromrecords(palist, names='c1, c2, c3, c4') |
| 421 | mpa = fromrecords(palist, names='c1, c2, c3, c4') |
| 422 | assert_equal_records(pa, mpa) |
| 423 | # ..... |
| 424 | _mrec = fromrecords(nrec) |
| 425 | assert_equal(_mrec.dtype, mrec.dtype) |
| 426 | for field in _mrec.dtype.names: |
| 427 | assert_equal(getattr(_mrec, field), getattr(mrec._data, field)) |
| 428 | |
| 429 | _mrec = fromrecords(nrec.tolist(), names='c1,c2,c3') |
| 430 | assert_equal(_mrec.dtype, [('c1', int), ('c2', float), ('c3', '|S5')]) |
| 431 | for (f, n) in zip(('c1', 'c2', 'c3'), ('a', 'b', 'c')): |
| 432 | assert_equal(getattr(_mrec, f), getattr(mrec._data, n)) |
| 433 | |
| 434 | _mrec = fromrecords(mrec) |
| 435 | assert_equal(_mrec.dtype, mrec.dtype) |
| 436 | assert_equal_records(_mrec._data, mrec.filled()) |
| 437 | assert_equal_records(_mrec._mask, mrec._mask) |
| 438 | |
| 439 | def test_fromrecords_wmask(self): |
| 440 | # Tests construction from records w/ mask. |
nothing calls this directly
no test coverage detected