Skip to content

Commit

Permalink
Refactor property usage
Browse files Browse the repository at this point in the history
  • Loading branch information
arman-ddl committed Mar 12, 2024
1 parent c58fbe9 commit 5838bb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion py/server/deephaven/table_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def delete(self, table: Table) -> None:
raise DHError(e, "delete data in the InputTable failed.") from e

@property
def get_key_names(self) -> List[str]:
def key_names(self) -> List[str]:
"""The names of the key columns of the InputTable.
"""
return j_list_to_list(self.j_input_table.getKeyNames())
Expand Down
16 changes: 8 additions & 8 deletions py/server/tests/test_table_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,24 +335,24 @@ def test_input_table(self):
self.assertEqual(append_only_input_table.size, 4)

keyed_input_table = input_table(col_defs=col_defs, key_cols="String")
self.assertEqual(keyed_input_table.get_key_names(), ["String"])
self.assertEqual(keyed_input_table.get_value_names(), [col.name for col in cols if col.name != "String"])
self.assertEqual(keyed_input_table.key_names, ["String"])
self.assertEqual(keyed_input_table.value_names, [col.name for col in cols if col.name != "String"])
keyed_input_table.add(t)
self.assertEqual(keyed_input_table.size, 2)
keyed_input_table.add(t)
self.assertEqual(keyed_input_table.size, 2)

with self.subTest("from init table"):
append_only_input_table = input_table(init_table=t)
self.assertEqual(append_only_input_table.get_key_names(), [])
self.assertEqual(append_only_input_table.get_value_names(), [col.name for col in cols])
self.assertEqual(append_only_input_table.key_names, [])
self.assertEqual(append_only_input_table.value_names, [col.name for col in cols])
self.assertEqual(append_only_input_table.size, 2)
append_only_input_table.add(t)
self.assertEqual(append_only_input_table.size, 4)

keyed_input_table = input_table(init_table=t, key_cols="String")
self.assertEqual(keyed_input_table.get_key_names(), ["String"])
self.assertEqual(keyed_input_table.get_value_names(), [col.name for col in cols if col.name != "String"])
self.assertEqual(keyed_input_table.key_names, ["String"])
self.assertEqual(keyed_input_table.value_names, [col.name for col in cols if col.name != "String"])
self.assertEqual(keyed_input_table.size, 2)
keyed_input_table.add(t)
self.assertEqual(keyed_input_table.size, 2)
Expand All @@ -366,8 +366,8 @@ def test_input_table(self):
self.assertIn("doesn\'t support delete operation", str(cm.exception))

keyed_input_table = input_table(init_table=t, key_cols=["String", "Double"])
self.assertEqual(keyed_input_table.get_key_names(), ["String", "Double"])
self.assertEqual(keyed_input_table.get_value_names(), [col.name for col in cols if col.name != "String" and col.name != "Double"])
self.assertEqual(keyed_input_table.key_names, ["String", "Double"])
self.assertEqual(keyed_input_table.value_names, [col.name for col in cols if col.name != "String" and col.name != "Double"])
self.assertEqual(keyed_input_table.size, 2)
keyed_input_table.delete(t.select(["String", "Double"]))
self.assertEqual(keyed_input_table.size, 0)
Expand Down

0 comments on commit 5838bb2

Please sign in to comment.