MCPcopy Create free account
hub / github.com/PyTables/PyTables / test02_readCoordsNum

Method test02_readCoordsNum

tables/tests/test_numpy.py:506–529  ·  view source on GitHub ↗

Column conversion into NumPy in read_coordinates(). NumPy.

(self)

Source from the content-addressed store, hash-verified

504 self.assertTrue(common.allequal(numcol, orignumcol, "numpy"))
505
506 def test02_readCoordsNum(self):
507 """Column conversion into NumPy in read_coordinates().
508
509 NumPy.
510
511 """
512
513 table = self.h5file.root.table
514 table.flavor = "numpy"
515 coords = [1, 2, 3]
516 self.nrows = len(coords)
517 for colname in table.colnames:
518 numcol = table.read_coordinates(coords, field=colname)
519 typecol = table.coltypes[colname]
520 type_ = numcol.dtype.type
521 if typecol != "string":
522 if typecol == "int64":
523 return
524 if common.verbose:
525 print("Type of read NumPy column:", type_)
526 print("Should look like:", typecol)
527 orignumcol = np.ones(shape=self.nrows, dtype=numcol.dtype.char)
528 # Check that both NumPy objects are equal
529 self.assertTrue(common.allequal(numcol, orignumcol, "numpy"))
530
531 def test03_getIndexNumPy(self):
532 """Getting table rows specified as NumPy scalar integers."""

Callers

nothing calls this directly

Calls 1

read_coordinatesMethod · 0.80

Tested by

no test coverage detected