@@ -33,14 +33,14 @@ class TestExecute(WithSchema):
33
33
34
34
def test_execute_executes (self ):
35
35
self .db .execute ("CREATE TABLE foo (bar text)" )
36
- actual = list ( self .db .fetchall ("SELECT tablename FROM pg_tables "
37
- "WHERE schemaname='public'" ) )
36
+ actual = self .db .fetchall ("SELECT tablename FROM pg_tables "
37
+ "WHERE schemaname='public'" )
38
38
assert actual == [{"tablename" : "foo" }]
39
39
40
40
def test_execute_inserts (self ):
41
41
self .db .execute ("CREATE TABLE foo (bar text)" )
42
42
self .db .execute ("INSERT INTO foo VALUES ('baz')" )
43
- actual = len (list ( self .db .fetchone ("SELECT * FROM foo ORDER BY bar" ) ))
43
+ actual = len (self .db .fetchone ("SELECT * FROM foo ORDER BY bar" ))
44
44
assert actual == 1
45
45
46
46
@@ -55,7 +55,7 @@ def test_fetchone_returns_None_if_theres_none(self):
55
55
assert actual is None
56
56
57
57
def test_fetchall_fetches_all (self ):
58
- actual = list ( self .db .fetchall ("SELECT * FROM foo ORDER BY bar" ) )
58
+ actual = self .db .fetchall ("SELECT * FROM foo ORDER BY bar" )
59
59
assert actual == [{"bar" : "baz" }, {"bar" : "buz" }]
60
60
61
61
@@ -81,14 +81,14 @@ def test_transaction_is_isolated(self):
81
81
with self .db .get_transaction () as txn :
82
82
txn .execute ("INSERT INTO foo VALUES ('blam')" )
83
83
txn .execute ("SELECT * FROM foo ORDER BY bar" )
84
- actual = list ( self .db .fetchall ("SELECT * FROM foo ORDER BY bar" ) )
84
+ actual = self .db .fetchall ("SELECT * FROM foo ORDER BY bar" )
85
85
assert actual == [{"bar" : "baz" }, {"bar" : "buz" }]
86
86
87
87
def test_transaction_commits_on_success (self ):
88
88
with self .db .get_transaction () as txn :
89
89
txn .execute ("INSERT INTO foo VALUES ('blam')" )
90
90
txn .execute ("SELECT * FROM foo ORDER BY bar" )
91
- actual = list ( self .db .fetchall ("SELECT * FROM foo ORDER BY bar" ) )
91
+ actual = self .db .fetchall ("SELECT * FROM foo ORDER BY bar" )
92
92
assert actual == [{"bar" : "baz" }, {"bar" : "blam" }, {"bar" : "buz" }]
93
93
94
94
def test_transaction_rolls_back_on_failure (self ):
@@ -100,7 +100,7 @@ class Heck(Exception): pass
100
100
raise Heck
101
101
except Heck :
102
102
pass
103
- actual = list ( self .db .fetchall ("SELECT * FROM foo ORDER BY bar" ) )
103
+ actual = self .db .fetchall ("SELECT * FROM foo ORDER BY bar" )
104
104
assert actual == [{"bar" : "baz" }, {"bar" : "buz" }]
105
105
106
106
0 commit comments