def test_null(self, tmpdir, filename, headers, expected): loader = ptr.SqliteFileLoader(filename) loader.headers = headers with pytest.raises(expected): for _tabletuple in loader.load(): pass
def test_normal(self, tmpdir, test_id, tabledata, filename, headers, expected): file_path = Path(str(tmpdir.join(filename))) file_path.parent.makedirs_p() con = SimpleSQLite(file_path, "w") con.create_table_from_tabledata(tabledata) loader = ptr.SqliteFileLoader(file_path) loader.headers = headers for tabledata in loader.load(): print("test-id={}".format(test_id)) print(dumps_tabledata(tabledata)) assert tabledata.in_tabledata_list(expected)
def test_normal(self, tmpdir, table, header, value, expected): test_file_path = tmpdir.join("test.sqlite") writer = ptw.SqliteTableWriter() writer.open(str(test_file_path)) writer.table_name = table writer.header_list = header writer.value_matrix = value writer.iteration_length = len(value) writer.write_table_iter() writer.close() loader = ptr.SqliteFileLoader(str(test_file_path)) for table_data in loader.load(): assert table_data == expected
def test_normal(self, tmpdir, table, header, value, expected): test_file_path = tmpdir.join("test.sqlite") writer = ptw.SqliteTableWriter() writer.open(str(test_file_path)) writer.table_name = table writer.header_list = header writer.value_matrix = value writer.write_table() writer.close() loader = ptr.SqliteFileLoader(str(test_file_path)) for table_data in loader.load(): expected_dump = ptw.dump_tabledata(expected) actual_dump = ptw.dump_tabledata(table_data) print_test_result(expected=expected_dump, actual=actual_dump) assert actual_dump == expected_dump