def test_create_table(): print("test_create_table") con = main.create_connection(database) main.create_table(con) # created table called arrests command = "SELECT name FROM sqlite_master WHERE type='table' AND name='arrests';" cur = con.cursor() assert cur.execute(command).fetchall()[0][0] == 'arrests'
def test_insert_table(): print("test_insert_table") dfdata = main.extractincidents(page1data) con = main.create_connection(database) main.create_table(con) main.insert_table(con , dfdata) com_len_rows = "SELECT COUNT(*) FROM arrests" cur = con.cursor() assert cur.execute(com_len_rows).fetchall()[0][0] == 10 com = "PRAGMA table_info(arrests);" c = con.cursor() assert len(c.execute(com).fetchall()) == 9
def test_get_Random_Value(): print("test get_Random_Value") conn = main.create_connection(database) assert type(main.get_Random_Value(conn)) == str assert len(main.get_Random_Value(conn)) >= 1
def test_create_connection(): print("test_create_connection") con = main.create_connection(database) assert con is not None