def test_concat(self) -> None: new_store = ExampleStore(a="d", b=4, c=False) actual = ExampleStore.concat([self.test_store, new_store], ignore_index=True) assert_that(actual.a.tolist(), equal_to(["a", "b", "c", "d"])) assert_that(actual.b.tolist(), equal_to([1, 2, 3, 4])) assert_that(actual.c.tolist(), equal_to([True, False, True, False])) expected = ExampleStore(a=["a", "b", "c", "d"], b=[1, 2, 3, 4], c=[True, False, True, False]) assert_that(actual.equals(expected), is_(True))
def test_insert_from_values(self) -> None: with self.db_adapter: test1 = ExampleStore(a=["a", "b", "c"], b=[1, 2, 3], c=[True, False, True]) self.db_adapter.create_group(ExampleStore.data_token.data_group) self.db_adapter.create_group_table(ExampleStore.data_token, ExampleStore) self.db_adapter.insert(ExampleStore.data_token, test1) raw1 = self.db_adapter.query(ExampleStore.data_token) queried1 = ExampleStore.from_rows(raw1) assert_that(queried1.equals(test1), equal_to(True)) test_metadata = ExampleMetadata( test_str="test", test_int=123, test_float=0.123, test_bool=True, test_timestamp=datetime.now(), ) test2 = ExampleStore(a=["d"], b=[4], c=[False], metadata=test_metadata) self.db_adapter.insert(ExampleStore.data_token, test2) actual_metadata = self.db_adapter.get_group_table_metadata( ExampleStore.data_token, ExampleMetadata) assert_that(actual_metadata, equal_to(test_metadata)) test3 = ExampleStore.concat([test1, test2], ignore_index=True) raw2 = self.db_adapter.query(ExampleStore.data_token) queried2 = ExampleStore.from_rows(raw2) assert_that(queried2.equals(test3), equal_to(True))