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