diff options
Diffstat (limited to 'test/sql/test_query.py')
| -rw-r--r-- | test/sql/test_query.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 8a439c15c..0aefd4007 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -49,7 +49,7 @@ class QueryTest(fixtures.TestBase): def test_insert_heterogeneous_params(self): """test that executemany parameters are asserted to match the parameter set of the first.""" - assert_raises_message(exc.StatementError, + assert_raises_message(exc.StatementError, r"A value is required for bind parameter 'user_name', in " "parameter group 2 \(original cause: (sqlalchemy.exc.)?InvalidRequestError: A " "value is required for bind parameter 'user_name', in " @@ -60,7 +60,7 @@ class QueryTest(fixtures.TestBase): {'user_id':9} ) - # this succeeds however. We aren't yet doing + # this succeeds however. We aren't yet doing # a length check on all subsequent parameters. users.insert().execute( {'user_id':7}, @@ -99,7 +99,7 @@ class QueryTest(fixtures.TestBase): ret[col.key] = id if result.lastrow_has_defaults(): - criterion = and_(*[col==id for col, id in + criterion = and_(*[col==id for col, id in zip(table.primary_key, result.inserted_primary_key)]) row = engine.execute(table.select(criterion)).first() for c in table.c: @@ -217,7 +217,7 @@ class QueryTest(fixtures.TestBase): for engine in test_engines: - r = engine.execute(users.insert(), + r = engine.execute(users.insert(), {'user_name':'jack'}, ) assert r.closed @@ -312,7 +312,7 @@ class QueryTest(fixtures.TestBase): content = Table('content', self.metadata, Column('type', String(30)), ) - bar = Table('bar', self.metadata, + bar = Table('bar', self.metadata, Column('content_type', String(30)) ) self.metadata.create_all(testing.db) @@ -348,7 +348,7 @@ class QueryTest(fixtures.TestBase): result = util.pickle.loads(util.pickle.dumps(result)) eq_( - result, + result, [(7, "jack"), (8, "ed"), (9, "fred")] ) if use_labels: @@ -365,7 +365,7 @@ class QueryTest(fixtures.TestBase): if not pickle or use_labels: assert_raises(exc.NoSuchColumnError, lambda: result[0][addresses.c.user_id]) else: - # test with a different table. name resolution is + # test with a different table. name resolution is # causing 'user_id' to match when use_labels wasn't used. eq_(result[0][addresses.c.user_id], 7) @@ -387,7 +387,7 @@ class QueryTest(fixtures.TestBase): (unprintable(), "unprintable element.*"), ]: assert_raises_message( - exc.NoSuchColumnError, + exc.NoSuchColumnError, msg % repl, lambda: row[accessor] ) @@ -740,7 +740,7 @@ class QueryTest(fixtures.TestBase): dict(user_id=1, user_name='john'), ) - # test a little sqlite weirdness - with the UNION, + # test a little sqlite weirdness - with the UNION, # cols come back as "query_users.user_id" in cursor.description r = text("select query_users.user_id, query_users.user_name from query_users " "UNION select query_users.user_id, query_users.user_name from query_users", @@ -785,7 +785,7 @@ class QueryTest(fixtures.TestBase): ) # test using literal tablename.colname r = text('select query_users.user_id AS "query_users.user_id", ' - 'query_users.user_name AS "query_users.user_name" from query_users', + 'query_users.user_name AS "query_users.user_name" from query_users', bind=testing.db).execution_options(sqlite_raw_colnames=True).execute().first() eq_(r['query_users.user_id'], 1) eq_(r['query_users.user_name'], "john") @@ -1054,9 +1054,9 @@ class QueryTest(fixtures.TestBase): ) shadowed.create(checkfirst=True) try: - shadowed.insert().execute(shadow_id=1, shadow_name='The Shadow', parent='The Light', - row='Without light there is no shadow', - _parent='Hidden parent', + shadowed.insert().execute(shadow_id=1, shadow_name='The Shadow', parent='The Light', + row='Without light there is no shadow', + _parent='Hidden parent', _row='Hidden row') r = shadowed.select(shadowed.c.shadow_id==1).execute().first() self.assert_(r.shadow_id == r['shadow_id'] == r[shadowed.c.shadow_id] == 1) @@ -1104,7 +1104,7 @@ class QueryTest(fixtures.TestBase): @testing.fails_on('firebird', "uses sql-92 rules") @testing.fails_on('sybase', "uses sql-92 rules") @testing.fails_on('mssql+mxodbc', "uses sql-92 rules") - @testing.fails_if(lambda: + @testing.fails_if(lambda: testing.against('mssql+pyodbc') and not testing.db.dialect.freetds, "uses sql-92 rules") def test_bind_in(self): @@ -1144,7 +1144,7 @@ class QueryTest(fixtures.TestBase): @testing.emits_warning('.*empty sequence.*') @testing.requires.boolean_col_expressions def test_in_filtering_advanced(self): - """test the behavior of the in_() function when + """test the behavior of the in_() function when comparing against an empty collection, specifically that a proper boolean value is generated. @@ -1167,7 +1167,7 @@ class QueryTest(fixtures.TestBase): class PercentSchemaNamesTest(fixtures.TestBase): """tests using percent signs, spaces in table and column names. - Doesn't pass for mysql, postgresql, but this is really a + Doesn't pass for mysql, postgresql, but this is really a SQLAlchemy bug - we should be escaping out %% signs for this operation the same way we do for text() and column labels. @@ -1181,7 +1181,7 @@ class PercentSchemaNamesTest(fixtures.TestBase): Column("percent%", Integer), Column("spaces % more spaces", Integer), ) - lightweight_percent_table = sql.table('percent%table', + lightweight_percent_table = sql.table('percent%table', sql.column("percent%"), sql.column("spaces % more spaces"), ) @@ -1194,7 +1194,7 @@ class PercentSchemaNamesTest(fixtures.TestBase): def teardown_class(cls): metadata.drop_all() - @testing.skip_if(lambda: testing.against('postgresql'), + @testing.skip_if(lambda: testing.against('postgresql'), "psycopg2 2.4 no longer accepts % in bind placeholders") def test_single_roundtrip(self): percent_table.insert().execute( @@ -1211,7 +1211,7 @@ class PercentSchemaNamesTest(fixtures.TestBase): ) self._assert_table() - @testing.skip_if(lambda: testing.against('postgresql'), + @testing.skip_if(lambda: testing.against('postgresql'), "psycopg2 2.4 no longer accepts % in bind placeholders") @testing.crashes('mysql+mysqldb', "MySQLdb handles executemany() " "inconsistently vs. execute()") @@ -1228,9 +1228,9 @@ class PercentSchemaNamesTest(fixtures.TestBase): def _assert_table(self): for table in ( - percent_table, - percent_table.alias(), - lightweight_percent_table, + percent_table, + percent_table.alias(), + lightweight_percent_table, lightweight_percent_table.alias()): eq_( list( @@ -1314,7 +1314,7 @@ class KeyTargetingTest(fixtures.TablesTest): content = Table('content', metadata, Column('t', String(30), key="type"), ) - bar = Table('bar', metadata, + bar = Table('bar', metadata, Column('ctype', String(30), key="content_type") ) @@ -1611,7 +1611,7 @@ class CompoundTest(fixtures.TestBase): eq_(found2, wanted) def test_union_all_lightweight(self): - """like test_union_all, but breaks the sub-union into + """like test_union_all, but breaks the sub-union into a subquery with an explicit column reference on the outside, more palatable to a wider variety of engines. |
