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

Method test02_getWhereList

tables/tests/test_numpy.py:722–743  ·  view source on GitHub ↗

Checking the return of NumPy in get_where_list method.

(self)

Source from the content-addressed store, hash-verified

720 self.assertEqual(bytes(col.copy().data), bytes(npcol.data))
721
722 def test02_getWhereList(self):
723 """Checking the return of NumPy in get_where_list method."""
724
725 if self.close:
726 self._reopen(mode="a")
727 table = self.h5file.root.table
728 data = table.get_where_list("z == 1")
729 if common.verbose:
730 print("Type of read:", type(data))
731 print("Description of the record:", data.dtype.descr)
732 print("First 3 elements of read:", data[:3])
733
734 # Check that both NumPy objects are equal
735 self.assertIsInstance(data, np.ndarray)
736
737 # Check that all columns have been selected
738 self.assertEqual(len(data), 100)
739
740 # Finally, check that the contents are ok
741 self.assertTrue(
742 common.allequal(data, np.arange(100, dtype="i8"), "numpy")
743 )
744
745 def test03a_readWhere(self):
746 """Checking the return of NumPy in read_where method (strings)."""

Callers

nothing calls this directly

Calls 2

get_where_listMethod · 0.80
_reopenMethod · 0.45

Tested by

no test coverage detected