def test_database_default(self): query = Query() database = Database('database_name', query) self.assertEqual(database.get_name(), 'database_name') self.assertEqual(database.get_tables(), {}) self.assertEqual(database.get_error(), '') self.assertEqual(database.has_error(), False) self.assertEqual(database.get_query(), query)
def __present_interface(self, database: Database) -> None: """ Auxiliary function, aimed to show a quantity of tables found, and list them. :param database: Database :return: """ print(f'Tables found: {len(database.get_tables())}') keys = database.get_tables().keys() for key in keys: print(key)
def test_database_setters(self): query = Query() query.set_table('tada') table = Table('table_name', []) error_text = 'some error' database = Database('database_name', query) database.add_table(table) database.set_error(error_text) self.assertEqual(database.get_name(), 'database_name') self.assertEqual(database.get_tables(), {'table_name': table}) self.assertEqual(database.get_error(), error_text) self.assertEqual(database.has_error(), True) self.assertEqual(database.get_query(), query)