Column conversion into NumPy in readCoords(). Chars
(self)
| 473 | self.assertTrue(common.allequal(numcol, orignumcol, "numpy")) |
| 474 | |
| 475 | def test02_readCoordsChar(self): |
| 476 | """Column conversion into NumPy in readCoords(). |
| 477 | |
| 478 | Chars |
| 479 | |
| 480 | """ |
| 481 | |
| 482 | table = self.h5file.root.table |
| 483 | table.flavor = "numpy" |
| 484 | coords = [1, 2, 3] |
| 485 | self.nrows = len(coords) |
| 486 | for colname in table.colnames: |
| 487 | numcol = table.read_coordinates(coords, field=colname) |
| 488 | typecol = table.coltypes[colname] |
| 489 | itemsizecol = table.description._v_dtypes[colname].base.itemsize |
| 490 | nctypecode = numcol.dtype.char |
| 491 | if typecol == "string": |
| 492 | if itemsizecol > 1: |
| 493 | orignumcol = np.array(["abcd"] * self.nrows, dtype="S4") |
| 494 | else: |
| 495 | orignumcol = np.array(["a"] * self.nrows, dtype="S1") |
| 496 | if common.verbose: |
| 497 | print("Typecode of NumPy column read:", nctypecode) |
| 498 | print("Should look like:", "c") |
| 499 | print("Itemsize of column:", itemsizecol) |
| 500 | print("Shape of NumPy column read:", numcol.shape) |
| 501 | print("Should look like:", orignumcol.shape) |
| 502 | print("First 3 elements of read col:", numcol[:3]) |
| 503 | # Check that both NumPy objects are equal |
| 504 | self.assertTrue(common.allequal(numcol, orignumcol, "numpy")) |
| 505 | |
| 506 | def test02_readCoordsNum(self): |
| 507 | """Column conversion into NumPy in read_coordinates(). |
nothing calls this directly
no test coverage detected