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

Method test11a

tables/tests/test_indexvalues.py:2301–2332  ·  view source on GitHub ↗

Checking selecting values from an Index via read_coordinates()

(self)

Source from the content-addressed store, hash-verified

2299 self.assertEqual(results1, results2)
2300
2301 def test11a(self):
2302 """Checking selecting values from an Index via read_coordinates()"""
2303
2304 if common.verbose:
2305 print("\n", "-=" * 30)
2306 print("Running %s.test11a..." % self.__class__.__name__)
2307
2308 table1 = self.h5file.root.table1
2309 table2 = self.h5file.root.table2
2310
2311 # Convert the limits to the appropriate type
2312 il = str(self.il).encode("ascii")
2313 sl = str(self.sl).encode("ascii")
2314
2315 # Do a selection and check the result
2316 t1var1 = table1.cols.var1
2317 condition = "(il<=t1var1)&(t1var1<=sl)"
2318 self.assertTrue(
2319 table1.will_query_use_indexing(condition)
2320 == fzset([t1var1.pathname])
2321 )
2322 coords1 = table1.get_where_list(condition)
2323 table1.flavor = "python"
2324 results1 = table1.read_coordinates(coords1, field="var1")
2325 results2 = [p["var1"] for p in table2 if il <= p["var1"] <= sl]
2326 results1.sort()
2327 results2.sort()
2328 if common.verbose:
2329 print("Length results:", len(results1))
2330 print("Should be:", len(results2))
2331 self.assertEqual(len(results1), len(results2))
2332 self.assertEqual(results1, results2)
2333
2334 def test12a(self):
2335 """Checking selecting values after a Table.append() operation."""

Callers

nothing calls this directly

Calls 3

get_where_listMethod · 0.80
read_coordinatesMethod · 0.80

Tested by

no test coverage detected