diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-28 14:08:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-09-28 15:17:26 -0400 |
| commit | c3f102c9fe9811fd5286628cc6aafa5fbc324621 (patch) | |
| tree | 4a78723089ded623701667de1eee21d22edbe6c1 /test/sql | |
| parent | 75ac0abc7d5653d10006769a881374a46b706db5 (diff) | |
| download | sqlalchemy-c3f102c9fe9811fd5286628cc6aafa5fbc324621.tar.gz | |
upgrade to black 20.8b1
It's better, the majority of these changes look more readable to me.
also found some docstrings that had formatting / quoting issues.
Change-Id: I582a45fde3a5648b2f36bab96bad56881321899b
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_compare.py | 9 | ||||
| -rw-r--r-- | test/sql/test_compiler.py | 39 | ||||
| -rw-r--r-- | test/sql/test_cte.py | 14 | ||||
| -rw-r--r-- | test/sql/test_defaults.py | 13 | ||||
| -rw-r--r-- | test/sql/test_deprecations.py | 29 | ||||
| -rw-r--r-- | test/sql/test_external_traversal.py | 10 | ||||
| -rw-r--r-- | test/sql/test_functions.py | 3 | ||||
| -rw-r--r-- | test/sql/test_identity_column.py | 18 | ||||
| -rw-r--r-- | test/sql/test_insert_exec.py | 18 | ||||
| -rw-r--r-- | test/sql/test_metadata.py | 13 | ||||
| -rw-r--r-- | test/sql/test_operators.py | 6 | ||||
| -rw-r--r-- | test/sql/test_query.py | 32 | ||||
| -rw-r--r-- | test/sql/test_quote.py | 3 | ||||
| -rw-r--r-- | test/sql/test_resultset.py | 13 | ||||
| -rw-r--r-- | test/sql/test_returning.py | 7 | ||||
| -rw-r--r-- | test/sql/test_roles.py | 6 | ||||
| -rw-r--r-- | test/sql/test_selectable.py | 12 | ||||
| -rw-r--r-- | test/sql/test_sequences.py | 56 | ||||
| -rw-r--r-- | test/sql/test_types.py | 3 | ||||
| -rw-r--r-- | test/sql/test_update.py | 8 | ||||
| -rw-r--r-- | test/sql/test_values.py | 3 |
21 files changed, 232 insertions, 83 deletions
diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py index 098606a91..257013ac4 100644 --- a/test/sql/test_compare.py +++ b/test/sql/test_compare.py @@ -333,7 +333,11 @@ class CoreFixtures(object): (table_a.c.b == 10, 20), (table_a.c.a == 9, 12), ), - case((table_a.c.a == 5, 10), (table_a.c.a == 10, 20), else_=30,), + case( + (table_a.c.a == 5, 10), + (table_a.c.a == 10, 20), + else_=30, + ), case({"wendy": "W", "jack": "J"}, value=table_a.c.a, else_="E"), case({"wendy": "W", "jack": "J"}, value=table_a.c.b, else_="E"), case({"wendy_w": "W", "jack": "J"}, value=table_a.c.a, else_="E"), @@ -1006,7 +1010,8 @@ class CacheKeyTest(CacheKeyFixture, CoreFixtures, fixtures.TestBase): ) self._run_cache_key_fixture( - fixture, True, + fixture, + True, ) def test_bindparam_subclass_nocache(self): diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index a6118c03f..7fd4e683b 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -447,7 +447,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): # this is native_boolean=False for default dialect self.assert_compile( - select(not_(True)).apply_labels(), "SELECT :param_1 = 0 AS anon_1", + select(not_(True)).apply_labels(), + "SELECT :param_1 = 0 AS anon_1", ) self.assert_compile( @@ -727,7 +728,11 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): foo_bar__id = foo_bar.c.id._annotate({"some_orm_thing": True}) stmt = select( - foo.c.bar_id, foo_bar.c.id, foo_bar.c.id, foo_bar__id, foo_bar__id, + foo.c.bar_id, + foo_bar.c.id, + foo_bar.c.id, + foo_bar__id, + foo_bar__id, ).apply_labels() self.assert_compile( @@ -752,9 +757,7 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): ) def test_nested_label_targeting(self): - """test nested anonymous label generation. - - """ + """test nested anonymous label generation.""" s1 = table1.select() s2 = s1.alias() s3 = select(s2).apply_labels() @@ -1491,7 +1494,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): def test_order_by_nulls(self): self.assert_compile( table2.select().order_by( - table2.c.otherid, table2.c.othername.desc().nullsfirst(), + table2.c.otherid, + table2.c.othername.desc().nullsfirst(), ), "SELECT myothertable.otherid, myothertable.othername FROM " "myothertable ORDER BY myothertable.otherid, " @@ -1500,7 +1504,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): self.assert_compile( table2.select().order_by( - table2.c.otherid, table2.c.othername.desc().nullslast(), + table2.c.otherid, + table2.c.othername.desc().nullslast(), ), "SELECT myothertable.otherid, myothertable.othername FROM " "myothertable ORDER BY myothertable.otherid, " @@ -1519,7 +1524,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): self.assert_compile( table2.select().order_by( - table2.c.otherid.nullsfirst(), table2.c.othername.desc(), + table2.c.otherid.nullsfirst(), + table2.c.othername.desc(), ), "SELECT myothertable.otherid, myothertable.othername FROM " "myothertable ORDER BY myothertable.otherid NULLS FIRST, " @@ -2068,7 +2074,10 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): "Can't resolve label reference for ORDER BY / GROUP BY / " "DISTINCT etc. Textual " "SQL expression 'noname'", - union(select(table1.c.myid, table1.c.name), select(table2),) + union( + select(table1.c.myid, table1.c.name), + select(table2), + ) .order_by("noname") .compile, ) @@ -3159,7 +3168,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase): def _test_binds_no_hash_collision(self): """test that construct_params doesn't corrupt dict - due to hash collisions""" + due to hash collisions""" total_params = 100000 @@ -3468,7 +3477,12 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase): compiled = stmt_adapted.compile(cache_key=cache_key) # params set up as 5 - eq_(compiled.construct_params(params={},), {"myid_1": 5}) + eq_( + compiled.construct_params( + params={}, + ), + {"myid_1": 5}, + ) # also works w the original cache key eq_( @@ -3529,7 +3543,8 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase): compiled = modified_stmt.compile(cache_key=cache_key) eq_( - compiled.construct_params(params={}), {"myid_1": 10, "myid_2": 12}, + compiled.construct_params(params={}), + {"myid_1": 10, "myid_2": 12}, ) # make a new statement doing the same thing and make sure diff --git a/test/sql/test_cte.py b/test/sql/test_cte.py index 410f49f2a..4ebfdc7ac 100644 --- a/test/sql/test_cte.py +++ b/test/sql/test_cte.py @@ -261,9 +261,7 @@ class CTETest(fixtures.TestBase, AssertsCompiledSQL): ) def test_recursive_union_alias_two(self): - """ - - """ + """""" # I know, this is the PG VALUES keyword, # we're cheating here. also yes we need the SELECT, @@ -773,7 +771,10 @@ class CTETest(fixtures.TestBase, AssertsCompiledSQL): s2 = ( select( - orders.c.order == "y", s1a.c.order, orders.c.order, s1.c.order, + orders.c.order == "y", + s1a.c.order, + orders.c.order, + s1.c.order, ) .where(orders.c.order == "z") .cte("regional_sales_2") @@ -815,7 +816,10 @@ class CTETest(fixtures.TestBase, AssertsCompiledSQL): s2 = ( select( - orders.c.order == "y", s1a.c.order, orders.c.order, s1.c.order, + orders.c.order == "y", + s1a.c.order, + orders.c.order, + s1.c.order, ) .where(orders.c.order == "z") .cte("regional_sales_2") diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py index 6cb1c3841..2750568d8 100644 --- a/test/sql/test_defaults.py +++ b/test/sql/test_defaults.py @@ -250,7 +250,12 @@ class DefaultObjectTest(fixtures.TestBase): Column("boolcol1", sa.Boolean, default=True), Column("boolcol2", sa.Boolean, default=False), # python function which uses ExecutionContext - Column("col7", Integer, default=lambda: 5, onupdate=lambda: 10,), + Column( + "col7", + Integer, + default=lambda: 5, + onupdate=lambda: 10, + ), # python builtin Column( "col8", @@ -1277,11 +1282,13 @@ class SpecialTypePKTest(fixtures.TestBase): eq_(r.inserted_primary_key, (None,)) else: eq_( - r.inserted_primary_key, (expected_result,), + r.inserted_primary_key, + (expected_result,), ) eq_( - conn.execute(t.select()).first(), (expected_result, 5), + conn.execute(t.select()).first(), + (expected_result, 5), ) def test_plain(self): diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py index d078b36b8..f418eab6b 100644 --- a/test/sql/test_deprecations.py +++ b/test/sql/test_deprecations.py @@ -545,7 +545,11 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL): r"The \"whens\" argument to case\(\) is now passed" ): stmt = select(t1).where( - case(whens={t1.c.q == 5: "foo"}, else_="bat",) != "bat" + case( + whens={t1.c.q == 5: "foo"}, + else_="bat", + ) + != "bat" ) self.assert_compile( @@ -1607,7 +1611,8 @@ class PositionalTextTest(fixtures.TablesTest): @classmethod def insert_data(cls, connection): connection.execute( - cls.tables.text1.insert(), [dict(a="a1", b="b1", c="c1", d="d1")], + cls.tables.text1.insert(), + [dict(a="a1", b="b1", c="c1", d="d1")], ) def test_anon_aliased_overlapping(self, connection): @@ -1756,7 +1761,8 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): stmt = table.insert(values={}, inline=True) self.assert_compile( - stmt, "INSERT INTO sometable (foo) VALUES (foobar())", + stmt, + "INSERT INTO sometable (foo) VALUES (foobar())", ) with testing.expect_deprecated_20( @@ -1765,7 +1771,9 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): stmt = table.insert(inline=True) self.assert_compile( - stmt, "INSERT INTO sometable (foo) VALUES (foobar())", params={}, + stmt, + "INSERT INTO sometable (foo) VALUES (foobar())", + params={}, ) def test_update_inline_kw_defaults(self): @@ -1808,7 +1816,9 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_whereclause(self): table1 = table( - "mytable", Column("myid", Integer), Column("name", String(30)), + "mytable", + Column("myid", Integer), + Column("name", String(30)), ) with testing.expect_deprecated_20( @@ -1823,7 +1833,9 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_values(self): table1 = table( - "mytable", Column("myid", Integer), Column("name", String(30)), + "mytable", + Column("myid", Integer), + Column("name", String(30)), ) with testing.expect_deprecated_20( @@ -1835,7 +1847,10 @@ class DMLTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): ) def test_delete_whereclause(self): - table1 = table("mytable", Column("myid", Integer),) + table1 = table( + "mytable", + Column("myid", Integer), + ) with testing.expect_deprecated_20( "The delete.whereclause parameter will be " diff --git a/test/sql/test_external_traversal.py b/test/sql/test_external_traversal.py index 6b07ebba9..4edc9d025 100644 --- a/test/sql/test_external_traversal.py +++ b/test/sql/test_external_traversal.py @@ -702,7 +702,9 @@ class ClauseTest(fixtures.TestBase, AssertsCompiledSQL): subq = subq.alias("subq") s = select(t1.c.col1, subq.c.col1).select_from( - t1, subq, t1.join(subq, t1.c.col1 == subq.c.col2), + t1, + subq, + t1.join(subq, t1.c.col1 == subq.c.col2), ) s5 = CloningVisitor().traverse(s) eq_(str(s), str(s5)) @@ -2190,7 +2192,8 @@ class ValuesBaseTest(fixtures.TestBase, AssertsCompiledSQL): compile_state = i._compile_state_factory(i, None) self._compare_param_dict( - compile_state._dict_parameters, {"col1": 5, "col2": 6, "col3": 7}, + compile_state._dict_parameters, + {"col1": 5, "col2": 6, "col3": 7}, ) def test_kw_and_dict_simultaneously_single(self): @@ -2211,7 +2214,8 @@ class ValuesBaseTest(fixtures.TestBase, AssertsCompiledSQL): i = i.values([(5, 6, 7), (8, 9, 10)]) compile_state = i._compile_state_factory(i, None) eq_( - compile_state._dict_parameters, {"col1": 5, "col2": 6, "col3": 7}, + compile_state._dict_parameters, + {"col1": 5, "col2": 6, "col3": 7}, ) eq_(compile_state._has_multi_parameters, True) eq_( diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index 3c6140b81..f9a8f998e 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -1008,7 +1008,8 @@ class ExecuteTest(fixtures.TestBase): connection.execute(t2.insert()) connection.execute(t2.insert().values(value=func.length("one"))) connection.execute( - t2.insert().values(value=func.length("asfda") + -19), stuff="hi", + t2.insert().values(value=func.length("asfda") + -19), + stuff="hi", ) res = sorted(connection.execute(select(t2.c.value, t2.c.stuff))) diff --git a/test/sql/test_identity_column.py b/test/sql/test_identity_column.py index becb62159..2564022c2 100644 --- a/test/sql/test_identity_column.py +++ b/test/sql/test_identity_column.py @@ -57,7 +57,10 @@ class _IdentityDDLFixture(testing.AssertsCompiledSQL): dict(always=False, cache=1000, order=True), "BY DEFAULT AS IDENTITY (CACHE 1000 ORDER)", ), - (dict(order=True), "BY DEFAULT AS IDENTITY (ORDER)",), + ( + dict(order=True), + "BY DEFAULT AS IDENTITY (ORDER)", + ), ) def test_create_ddl(self, identity_args, text): @@ -153,10 +156,15 @@ class NotSupportingIdentityDDL(testing.AssertsCompiledSQL, fixtures.TestBase): MetaData(), Column("foo", Integer(), Identity("always", start=3)), ) - t2 = Table("foo_table", MetaData(), Column("foo", Integer()),) + t2 = Table( + "foo_table", + MetaData(), + Column("foo", Integer()), + ) exp = CreateTable(t2).compile(dialect=testing.db.dialect) self.assert_compile( - CreateTable(t), re.sub(r"[\n\t]", "", str(exp)), + CreateTable(t), + re.sub(r"[\n\t]", "", str(exp)), ) @@ -169,7 +177,9 @@ class IdentityTest(fixtures.TestBase): def fn(**kwargs): Table( - "t", MetaData(), Column("y", Integer, Identity(), **kwargs), + "t", + MetaData(), + Column("y", Integer, Identity(), **kwargs), ) assert_raises_message(ArgumentError, text, fn, server_default="42") diff --git a/test/sql/test_insert_exec.py b/test/sql/test_insert_exec.py index 45a8bccf5..198ff48c0 100644 --- a/test/sql/test_insert_exec.py +++ b/test/sql/test_insert_exec.py @@ -231,7 +231,10 @@ class InsertExecTest(fixtures.TablesTest): "t4", metadata, Column( - "id", Integer, Sequence("t4_id_seq"), primary_key=True, + "id", + Integer, + Sequence("t4_id_seq"), + primary_key=True, ), Column("foo", String(30)), ), @@ -387,7 +390,12 @@ class TableInsertTest(fixtures.TablesTest): Table( "foo", metadata, - Column("id", Integer, Sequence("t_id_seq"), primary_key=True,), + Column( + "id", + Integer, + Sequence("t_id_seq"), + primary_key=True, + ), Column("data", String(50)), Column("x", Integer), ) @@ -397,7 +405,11 @@ class TableInsertTest(fixtures.TablesTest): metadata, # note this will have full AUTO INCREMENT on MariaDB # whereas "foo" will not due to sequence support - Column("id", Integer, primary_key=True,), + Column( + "id", + Integer, + primary_key=True, + ), Column("data", String(50)), Column("x", Integer), ) diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index 9999bdc31..ebcde3c63 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -731,7 +731,11 @@ class MetaDataTest(fixtures.TestBase, ComparesTables): "Column('foo', Integer(), table=None, primary_key=True, " "nullable=False, onupdate=%s, default=%s, server_default=%s, " "comment='foo')" - % (ColumnDefault(1), ColumnDefault(42), DefaultClause("42"),), + % ( + ColumnDefault(1), + ColumnDefault(42), + DefaultClause("42"), + ), ), ( Table("bar", MetaData(), Column("x", String)), @@ -5243,7 +5247,8 @@ class CopyDialectOptionsTest(fixtures.TestBase): @classmethod def check_dialect_options_(cls, t): eq_( - t.dialect_kwargs["copydialectoptionstest_some_table_arg"], "a1", + t.dialect_kwargs["copydialectoptionstest_some_table_arg"], + "a1", ) eq_( t.c.foo.dialect_kwargs["copydialectoptionstest_some_column_arg"], @@ -5286,7 +5291,9 @@ class CopyDialectOptionsTest(fixtures.TestBase): copydialectoptionstest_some_table_arg="a1", ) Index( - "idx", t1.c.foo, copydialectoptionstest_some_index_arg="a4", + "idx", + t1.c.foo, + copydialectoptionstest_some_index_arg="a4", ) self.check_dialect_options_(t1) diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 3eb0c449f..2f9273859 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -1072,8 +1072,7 @@ class BooleanEvalTest(fixtures.TestBase, testing.AssertsCompiledSQL): class ConjunctionTest(fixtures.TestBase, testing.AssertsCompiledSQL): - """test interaction of and_()/or_() with boolean , null constants - """ + """test interaction of and_()/or_() with boolean , null constants""" __dialect__ = default.DefaultDialect(supports_native_boolean=True) @@ -1851,7 +1850,8 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL): ) .select_from( self.table1.join( - self.table2, self.table1.c.myid == self.table2.c.otherid, + self.table2, + self.table1.c.myid == self.table2.c.otherid, ) ) .order_by(self.table1.c.myid), diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 9b3ededcd..9f66a2ef5 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -157,7 +157,8 @@ class QueryTest(fixtures.TestBase): eq_(connection.execute(select(or_(true, false))).scalar(), True) eq_(connection.execute(select(or_(false, false))).scalar(), False) eq_( - connection.execute(select(not_(or_(false, false)))).scalar(), True, + connection.execute(select(not_(or_(false, false)))).scalar(), + True, ) row = connection.execute( @@ -174,7 +175,8 @@ class QueryTest(fixtures.TestBase): def test_select_tuple(self, connection): connection.execute( - users.insert(), {"user_id": 1, "user_name": "apples"}, + users.insert(), + {"user_id": 1, "user_name": "apples"}, ) assert_raises_message( @@ -351,7 +353,8 @@ class QueryTest(fixtures.TestBase): return "INT_%d" % value eq_( - connection.scalar(select(cast("INT_5", type_=MyInteger))), "INT_5", + connection.scalar(select(cast("INT_5", type_=MyInteger))), + "INT_5", ) eq_( connection.scalar( @@ -1213,7 +1216,8 @@ class CompoundTest(fixtures.TestBase): @testing.fails_on("sqlite", "FIXME: unknown") def test_union_all(self, connection): e = union_all( - select(t1.c.col3), union(select(t1.c.col3), select(t1.c.col3)), + select(t1.c.col3), + union(select(t1.c.col3), select(t1.c.col3)), ) wanted = [("aaa",), ("aaa",), ("bbb",), ("bbb",), ("ccc",), ("ccc",)] @@ -1734,35 +1738,45 @@ class JoinTest(fixtures.TestBase): for criteria in (t2.c.t2_id == t3.c.t2_id, t3.c.t2_id == t2.c.t2_id): expr = ( select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) - .where(t1.c.name == "t1 #10",) + .where( + t1.c.name == "t1 #10", + ) .select_from((t1.join(t2).outerjoin(t3, criteria))) ) self.assertRows(expr, [(10, 20, 30)]) expr = ( select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) - .where(t2.c.name == "t2 #20",) + .where( + t2.c.name == "t2 #20", + ) .select_from((t1.join(t2).outerjoin(t3, criteria))) ) self.assertRows(expr, [(10, 20, 30)]) expr = ( select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) - .where(t3.c.name == "t3 #30",) + .where( + t3.c.name == "t3 #30", + ) .select_from((t1.join(t2).outerjoin(t3, criteria))) ) self.assertRows(expr, [(10, 20, 30)]) expr = ( select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) - .where(and_(t1.c.name == "t1 #10", t2.c.name == "t2 #20"),) + .where( + and_(t1.c.name == "t1 #10", t2.c.name == "t2 #20"), + ) .select_from((t1.join(t2).outerjoin(t3, criteria))) ) self.assertRows(expr, [(10, 20, 30)]) expr = ( select(t1.c.t1_id, t2.c.t2_id, t3.c.t3_id) - .where(and_(t2.c.name == "t2 #20", t3.c.name == "t3 #30"),) + .where( + and_(t2.c.name == "t2 #20", t3.c.name == "t3 #30"), + ) .select_from((t1.join(t2).outerjoin(t3, criteria))) ) self.assertRows(expr, [(10, 20, 30)]) diff --git a/test/sql/test_quote.py b/test/sql/test_quote.py index 504ed4064..2dee9bc09 100644 --- a/test/sql/test_quote.py +++ b/test/sql/test_quote.py @@ -825,7 +825,8 @@ class QuoteTest(fixtures.TestBase, AssertsCompiledSQL): t2 = Table("t2", m, Column("x", Integer), quote=True) self.assert_compile( - select(t2.c.x).apply_labels(), 'SELECT "t2".x AS "t2_x" FROM "t2"', + select(t2.c.x).apply_labels(), + 'SELECT "t2".x AS "t2_x" FROM "t2"', ) diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py index 67f347ad3..7d6266541 100644 --- a/test/sql/test_resultset.py +++ b/test/sql/test_resultset.py @@ -1474,7 +1474,9 @@ class KeyTargetingTest(fixtures.TablesTest): Column("team_id", metadata, ForeignKey("teams.id")), ) Table( - "teams", metadata, Column("id", Integer, primary_key=True), + "teams", + metadata, + Column("id", Integer, primary_key=True), ) @classmethod @@ -1847,7 +1849,8 @@ class KeyTargetingTest(fixtures.TablesTest): # this has _result_columns structure that is not ordered # the same as the cursor.description. return text("select a AS keyed2_a, b AS keyed2_b from keyed2").columns( - keyed2_b=CHAR, keyed2_a=CHAR, + keyed2_b=CHAR, + keyed2_a=CHAR, ) def _adapt_result_columns_fixture_seven(self): @@ -1970,7 +1973,8 @@ class PositionalTextTest(fixtures.TablesTest): @classmethod def insert_data(cls, connection): connection.execute( - cls.tables.text1.insert(), [dict(a="a1", b="b1", c="c1", d="d1")], + cls.tables.text1.insert(), + [dict(a="a1", b="b1", c="c1", d="d1")], ) def test_via_column(self, connection): @@ -2589,7 +2593,8 @@ class MergeCursorResultTest(fixtures.TablesTest): result = r1.merge(r2, r3, r4) eq_( - result.first(), (7, "u1"), + result.first(), + (7, "u1"), ) for r in [r1, r2, r3, r4]: assert r.closed diff --git a/test/sql/test_returning.py b/test/sql/test_returning.py index 26d4969c8..601bd6273 100644 --- a/test/sql/test_returning.py +++ b/test/sql/test_returning.py @@ -260,7 +260,12 @@ class SequenceReturningTest(fixtures.TestBase): table = Table( "tables", meta, - Column("id", Integer, seq, primary_key=True,), + Column( + "id", + Integer, + seq, + primary_key=True, + ), Column("data", String(50)), ) with testing.db.connect() as conn: diff --git a/test/sql/test_roles.py b/test/sql/test_roles.py index 4feba97ae..8759bbb22 100644 --- a/test/sql/test_roles.py +++ b/test/sql/test_roles.py @@ -150,14 +150,16 @@ class RoleTest(fixtures.TestBase): "implicitly coercing SELECT object to scalar subquery" ): expect( - roles.LabeledColumnExprRole, select(column("q")), + roles.LabeledColumnExprRole, + select(column("q")), ) with testing.expect_warnings( "implicitly coercing SELECT object to scalar subquery" ): expect( - roles.LabeledColumnExprRole, select(column("q")).alias(), + roles.LabeledColumnExprRole, + select(column("q")).alias(), ) def test_statement_no_text_coercion(self): diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index d09fe76e1..b98fbd3d0 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -2898,7 +2898,8 @@ class WithLabelsTest(fixtures.TestBase): def test_labels_overlap_label(self): sel = self._labels_overlap().apply_labels() eq_( - list(sel.selected_columns.keys()), ["t_x_id", "t_x_id_1"], + list(sel.selected_columns.keys()), + ["t_x_id", "t_x_id_1"], ) eq_( list(sel.subquery().c.keys()), @@ -2941,10 +2942,12 @@ class WithLabelsTest(fixtures.TestBase): def test_keylabels_overlap_labels_dont_label(self): sel = self._keylabels_overlap_labels_dont().apply_labels() eq_( - list(sel.selected_columns.keys()), ["t_x_id", "t_x_b_1"], + list(sel.selected_columns.keys()), + ["t_x_id", "t_x_b_1"], ) eq_( - list(sel.subquery().c.keys()), ["t_x_id", "t_x_b_1"], + list(sel.subquery().c.keys()), + ["t_x_id", "t_x_b_1"], ) self._assert_result_keys(sel, ["t_a", "t_x_b"]) self._assert_subq_result_keys(sel, ["t_a", "t_x_b"]) @@ -2965,7 +2968,8 @@ class WithLabelsTest(fixtures.TestBase): def test_keylabels_overlap_labels_overlap_label(self): sel = self._keylabels_overlap_labels_overlap().apply_labels() eq_( - list(sel.selected_columns.keys()), ["t_x_a", "t_x_id_1"], + list(sel.selected_columns.keys()), + ["t_x_a", "t_x_id_1"], ) # deduping for different cols but same label diff --git a/test/sql/test_sequences.py b/test/sql/test_sequences.py index 243ccfbab..e609a8a91 100644 --- a/test/sql/test_sequences.py +++ b/test/sql/test_sequences.py @@ -124,14 +124,14 @@ class LegacySequenceExecTest(fixtures.TestBase): def test_explicit_optional(self): """test dialect executes a Sequence, returns nextval, whether - or not "optional" is set """ + or not "optional" is set""" s = Sequence("my_sequence", optional=True) self._assert_seq_result(s.execute(testing.db)) def test_func_implicit_connectionless_execute(self): """test func.next_value().execute()/.scalar() works - with connectionless execution. """ + with connectionless execution.""" s = Sequence("my_sequence", metadata=MetaData(testing.db)) self._assert_seq_result(s.next_value().execute().scalar()) @@ -178,21 +178,21 @@ class SequenceExecTest(fixtures.TestBase): def test_execute_optional(self, connection): """test dialect executes a Sequence, returns nextval, whether - or not "optional" is set """ + or not "optional" is set""" s = Sequence("my_sequence", optional=True) self._assert_seq_result(connection.execute(s)) def test_execute_next_value(self, connection): """test func.next_value().execute()/.scalar() works - with connectionless execution. """ + with connectionless execution.""" s = Sequence("my_sequence") self._assert_seq_result(connection.scalar(s.next_value())) def test_execute_optional_next_value(self, connection): """test func.next_value().execute()/.scalar() works - with connectionless execution. """ + with connectionless execution.""" s = Sequence("my_sequence", optional=True) self._assert_seq_result(connection.scalar(s.next_value())) @@ -225,7 +225,11 @@ class SequenceExecTest(fixtures.TestBase): """test can use next_value() in values() of _ValuesBase""" metadata = self.metadata - t1 = Table("t", metadata, Column("x", Integer),) + t1 = Table( + "t", + metadata, + Column("x", Integer), + ) t1.create(testing.db) s = Sequence("my_sequence") connection.execute(t1.insert().values(x=s.next_value())) @@ -263,7 +267,15 @@ class SequenceExecTest(fixtures.TestBase): metadata = self.metadata s = Sequence("my_sequence") - t1 = Table("t", metadata, Column("x", Integer, primary_key=True,),) + t1 = Table( + "t", + metadata, + Column( + "x", + Integer, + primary_key=True, + ), + ) t1.create(testing.db) e = engines.testing_engine(options={"implicit_returning": True}) @@ -424,7 +436,11 @@ class TableBoundSequenceTest(fixtures.TablesTest): Table( "Manager", metadata, - Column("obj_id", Integer, Sequence("obj_id_seq"),), + Column( + "obj_id", + Integer, + Sequence("obj_id_seq"), + ), Column("name", String(128)), Column( "id", @@ -477,10 +493,26 @@ class TableBoundSequenceTest(fixtures.TablesTest): conn.execute(sometable.select().order_by(sometable.c.id)) ), [ - (dsb, "somename", dsb,), - (dsb + 1, "someother", dsb + 1,), - (dsb + 2, "name3", dsb + 2,), - (dsb + 3, "name4", dsb + 3,), + ( + dsb, + "somename", + dsb, + ), + ( + dsb + 1, + "someother", + dsb + 1, + ), + ( + dsb + 2, + "name3", + dsb + 2, + ), + ( + dsb + 3, + "name4", + dsb + 3, + ), ], ) diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 5464750db..efa622b13 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -3236,7 +3236,8 @@ class BooleanTest( ) eq_( - conn.scalar(select(boolean_table.c.unconstrained_value)), True, + conn.scalar(select(boolean_table.c.unconstrained_value)), + True, ) def test_bind_processor_coercion_native_true(self): diff --git a/test/sql/test_update.py b/test/sql/test_update.py index 8be5868db..201e6c64f 100644 --- a/test/sql/test_update.py +++ b/test/sql/test_update.py @@ -461,7 +461,9 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): self.assert_compile( update(table1) .where(table1.c.name == bindparam("crit")) - .values({table1.c.name: "hi"},), + .values( + {table1.c.name: "hi"}, + ), "UPDATE mytable SET name=:name WHERE mytable.name = :crit", params={"crit": "notthere"}, checkparams={"crit": "notthere", "name": "hi"}, @@ -473,7 +475,9 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): self.assert_compile( update(table1) .where(table1.c.myid == 12) - .values({table1.c.name: table1.c.myid},), + .values( + {table1.c.name: table1.c.myid}, + ), "UPDATE mytable " "SET name=mytable.myid, description=:description " "WHERE mytable.myid = :myid_1", diff --git a/test/sql/test_values.py b/test/sql/test_values.py index 3b0544278..1e4f22442 100644 --- a/test/sql/test_values.py +++ b/test/sql/test_values.py @@ -117,7 +117,8 @@ class ValuesTest(fixtures.TablesTest, AssertsCompiledSQL): def test_with_join_unnamed(self): people = self.tables.people values = Values( - column("column1", Integer), column("column2", Integer), + column("column1", Integer), + column("column2", Integer), ).data([(1, 1), (2, 1), (3, 2), (3, 3)]) stmt = select(people, values).select_from( people.join(values, values.c.column2 == people.c.people_id) |
