예제 #1
0
    def test_tables_to_pandas(self):
        import pandas as pd

        table_list = TableList([Table("kar"), Table("car"), Table("dar")])

        pd.testing.assert_frame_equal(pd.DataFrame({"name": ["kar", "car", "dar"]}), table_list.to_pandas())
        pd.testing.assert_frame_equal(pd.DataFrame({"value": ["kar"]}, index=["name"]), table_list[0].to_pandas())
예제 #2
0
 def test_list(self, mock_raw_table_response):
     res_list = RAW_API.tables.list(db_name="db1")
     for res in res_list:
         assert "db1" == res._db_name
         assert COGNITE_CLIENT == res._cognite_client
     assert TableList([Table("table1")]) == res_list
예제 #3
0
 def test_get_tables_in_db(self, mock_raw_db_response,
                           mock_raw_table_response):
     db = RAW_API.databases.list()[0]
     tables = db.tables()
     assert TableList([Table(name="table1")]) == tables