diff options
Diffstat (limited to 'test/sql/test_rowcount.py')
-rw-r--r-- | test/sql/test_rowcount.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py index 2d3c51fa2..8913b955d 100644 --- a/test/sql/test_rowcount.py +++ b/test/sql/test_rowcount.py @@ -4,6 +4,7 @@ from sqlalchemy import testing class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults): + """tests rowcount functionality""" __requires__ = ('sane_rowcount', ) @@ -14,29 +15,29 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults): global employees_table, metadata metadata = MetaData(testing.db) - employees_table = Table('employees', metadata, - Column('employee_id', Integer, - Sequence('employee_id_seq', optional=True), - primary_key=True), - Column('name', String(50)), - Column('department', String(1)), - ) + employees_table = Table( + 'employees', metadata, Column( + 'employee_id', Integer, Sequence( + 'employee_id_seq', optional=True), primary_key=True), Column( + 'name', String(50)), Column( + 'department', String(1)), ) metadata.create_all() def setup(self): global data - data = [ ('Angela', 'A'), - ('Andrew', 'A'), - ('Anand', 'A'), - ('Bob', 'B'), - ('Bobette', 'B'), - ('Buffy', 'B'), - ('Charlie', 'C'), - ('Cynthia', 'C'), - ('Chris', 'C') ] + data = [('Angela', 'A'), + ('Andrew', 'A'), + ('Anand', 'A'), + ('Bob', 'B'), + ('Bobette', 'B'), + ('Buffy', 'B'), + ('Charlie', 'C'), + ('Cynthia', 'C'), + ('Chris', 'C')] i = employees_table.insert() - i.execute(*[{'name':n, 'department':d} for n, d in data]) + i.execute(*[{'name': n, 'department': d} for n, d in data]) + def teardown(self): employees_table.delete().execute() @@ -53,21 +54,20 @@ class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults): def test_update_rowcount1(self): # WHERE matches 3, 3 rows changed department = employees_table.c.department - r = employees_table.update(department=='C').execute(department='Z') + r = employees_table.update(department == 'C').execute(department='Z') print("expecting 3, dialect reports %s" % r.rowcount) assert r.rowcount == 3 def test_update_rowcount2(self): # WHERE matches 3, 0 rows changed department = employees_table.c.department - r = employees_table.update(department=='C').execute(department='C') + r = employees_table.update(department == 'C').execute(department='C') print("expecting 3, dialect reports %s" % r.rowcount) assert r.rowcount == 3 def test_delete_rowcount(self): # WHERE matches 3, 3 rows deleted department = employees_table.c.department - r = employees_table.delete(department=='C').execute() + r = employees_table.delete(department == 'C').execute() print("expecting 3, dialect reports %s" % r.rowcount) assert r.rowcount == 3 - |