Skip to content

Commit

Permalink
add additional query tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Mar 26, 2024
1 parent fdf1e40 commit 64cc5bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion h5pyd/_hl/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def libver(self):
return ("0.0.1",)

@property
def serverver(self):
def server_ver(self):
return self._version

@property
Expand Down
2 changes: 1 addition & 1 deletion test/hl/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_create(self):
self.assertTrue(f.modified >= f.created)

self.assertTrue(len(f.owner) > 0)
version = f.serverver
version = f.server_ver
# server version should be of form "n.n.n"
n = version.find(".")
self.assertTrue(n>=1)
Expand Down
11 changes: 11 additions & 0 deletions test/hl/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ def test_query_table(self):
quote = quotes[i]
self.assertTrue(quote[3] > 3000)
self.assertTrue(quote[3] < 3100)

# try where in list query
if f.server_ver.startswith("0.9"):
condition = "where symbol in (b'AAPL', b'EBAY')"
quotes = table.read_where(condition)
self.assertEqual(len(quotes), 8)
for i in range(8):
quote = quotes[i]
self.assertTrue(quote[1] in (b'AAPL', b'EBAY'))
else:
print("'where in' queries require HSDS version 0.9 or higher")

# try modifying specific rows
condition = "symbol == b'AAPL'"
Expand Down

0 comments on commit 64cc5bd

Please sign in to comment.