Skip to content

Commit

Permalink
modify unit test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zxyle committed Aug 4, 2020
1 parent 206fdf3 commit 2066818
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ def test_insert():

def test_query():
rows = my.query(test_table)
rows.pop("id")
rows.pop("create_time")
rows.pop("modify_time")
assert rows == test_data
row = rows[0]
row.pop("id")
row.pop("create_time")
row.pop("modify_time")
assert row == test_data


def test_update():
Expand All @@ -35,15 +36,15 @@ def test_update():
my.commit()

rows = my.query(test_table)
assert rows.get("age") == update_data.get("age")
assert rows[0].get("age") == update_data.get("age")


def test_delete():
condition = {}
my.delete(test_table, condition)

rows = my.query(test_table)
assert rows is None
assert rows == tuple()


def test_insert_many():
Expand All @@ -53,4 +54,4 @@ def test_insert_many():
def test_rollback():
my.insert_one(test_table, {"name": "zheng"})
my.rollback()
assert my.query(test_table, {"name": "zheng"}) is None
assert my.query(test_table, {"name": "zheng"}) == tuple()

0 comments on commit 2066818

Please sign in to comment.