コード例 #1
0
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'
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
def test_create_connection():
    print("test_create_connection")
    con = main.create_connection(database)
    assert con is not None