diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2021-11-21 20:36:35 +0100 |
|---|---|---|
| committer | Federico Caselli <cfederico87@gmail.com> | 2021-11-22 15:03:17 +0000 |
| commit | 0b95f0055be252b13e99b0a944466f60b5e367ff (patch) | |
| tree | 6ae4135fd408c4e69582c4f6fa458b007553aeab /test/sql | |
| parent | e04baa2953fb5d0d29f5dca01ea6882bf1fa1cd4 (diff) | |
| download | sqlalchemy-0b95f0055be252b13e99b0a944466f60b5e367ff.tar.gz | |
Remove object in class definition
References: #4600
Change-Id: I2a62ddfe00bc562720f0eae700a497495d7a987a
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_compare.py | 4 | ||||
| -rw-r--r-- | test/sql/test_defaults.py | 14 | ||||
| -rw-r--r-- | test/sql/test_delete.py | 2 | ||||
| -rw-r--r-- | test/sql/test_deprecations.py | 2 | ||||
| -rw-r--r-- | test/sql/test_insert.py | 4 | ||||
| -rw-r--r-- | test/sql/test_lambdas.py | 12 | ||||
| -rw-r--r-- | test/sql/test_metadata.py | 18 | ||||
| -rw-r--r-- | test/sql/test_operators.py | 4 | ||||
| -rw-r--r-- | test/sql/test_resultset.py | 6 | ||||
| -rw-r--r-- | test/sql/test_roles.py | 6 | ||||
| -rw-r--r-- | test/sql/test_select.py | 6 | ||||
| -rw-r--r-- | test/sql/test_type_expressions.py | 4 | ||||
| -rw-r--r-- | test/sql/test_types.py | 16 | ||||
| -rw-r--r-- | test/sql/test_update.py | 10 | ||||
| -rw-r--r-- | test/sql/test_values.py | 2 |
15 files changed, 55 insertions, 55 deletions
diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py index 5258d09b0..814d9a2ad 100644 --- a/test/sql/test_compare.py +++ b/test/sql/test_compare.py @@ -166,7 +166,7 @@ class MyType3(TypeDecorator): self.arg = arg -class CoreFixtures(object): +class CoreFixtures: # lambdas which return a tuple of ColumnElement objects. # must return at least two objects that should compare differently. # to test more varieties of "difference" additional objects can be added. @@ -1049,7 +1049,7 @@ class CoreFixtures(object): ] -class CacheKeyFixture(object): +class CacheKeyFixture: def _compare_equal(self, a, b, compare_values): a_key = a._generate_cache_key() b_key = b._generate_cache_key() diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py index 2011744fb..f3260f272 100644 --- a/test/sql/test_defaults.py +++ b/test/sql/test_defaults.py @@ -140,11 +140,11 @@ class DefaultObjectTest(fixtures.TestBase): def fn2(x, y, z=3): pass - class fn3(object): + class fn3: def __init__(self, x, y): pass - class FN4(object): + class FN4: def __call__(self, x, y): pass @@ -170,21 +170,21 @@ class DefaultObjectTest(fixtures.TestBase): fn5 = list - class fn6a(object): + class fn6a: def __init__(self, x): eq_(x, "context") - class fn6b(object): + class fn6b: def __init__(self, x, y=3): eq_(x, "context") - class FN7(object): + class FN7: def __call__(self, x): eq_(x, "context") fn7 = FN7() - class FN8(object): + class FN8: def __call__(self, x, y=3): eq_(x, "context") @@ -396,7 +396,7 @@ class DefaultRoundTripTest(fixtures.TablesTest): use_function_defaults = testing.against("postgresql", "mssql") is_oracle = testing.against("oracle") - class MyClass(object): + class MyClass: @classmethod def gen_default(cls, ctx): return "hi" diff --git a/test/sql/test_delete.py b/test/sql/test_delete.py index 6f7b3f8f5..45ead811f 100644 --- a/test/sql/test_delete.py +++ b/test/sql/test_delete.py @@ -21,7 +21,7 @@ from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table -class _DeleteTestBase(object): +class _DeleteTestBase: @classmethod def define_tables(cls, metadata): Table( diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py index 46c526c4b..89938ee5e 100644 --- a/test/sql/test_deprecations.py +++ b/test/sql/test_deprecations.py @@ -1811,7 +1811,7 @@ class FutureSelectTest(fixtures.TestBase, AssertsCompiledSQL): def test_new_calling_style_thing_ok_actually_use_iter(self, table_fixture): table1, table2 = table_fixture - class Thing(object): + class Thing: def __iter__(self): return iter([table1.c.name, table1.c.description]) diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py index 51045daac..74a60bd21 100644 --- a/test/sql/test_insert.py +++ b/test/sql/test_insert.py @@ -28,7 +28,7 @@ from sqlalchemy.testing import expect_warnings from sqlalchemy.testing import fixtures -class ORMExpr(object): +class ORMExpr: def __init__(self, col): self.col = col @@ -36,7 +36,7 @@ class ORMExpr(object): return self.col -class _InsertTestBase(object): +class _InsertTestBase: @classmethod def define_tables(cls, metadata): Table( diff --git a/test/sql/test_lambdas.py b/test/sql/test_lambdas.py index a2aa9705c..fd6b1eb41 100644 --- a/test/sql/test_lambdas.py +++ b/test/sql/test_lambdas.py @@ -689,7 +689,7 @@ class LambdaElementTest( # refer to unknown types of objects inside the lambda. these have # to be resolved outside of the lambda because we otherwise can't # be sure they can be safely used as cache keys. - class Thing(object): + class Thing: def __init__(self, col_expr): self.col_expr = col_expr @@ -713,7 +713,7 @@ class LambdaElementTest( # refer to unknown types of objects inside the lambda. these have # to be resolved outside of the lambda because we otherwise can't # be sure they can be safely used as cache keys. - class Thing(object): + class Thing: def __init__(self, col_expr): self.col_expr = col_expr @@ -765,7 +765,7 @@ class LambdaElementTest( # test the above 'test_reject_plain_object' with the expected # workaround - class Thing(object): + class Thing: def __init__(self, col_expr): self.col_expr = col_expr @@ -1662,7 +1662,7 @@ class LambdaElementTest( def test_cache_key_instance_variable_issue_incorrect(self): t1 = table("t1", column("q"), column("p")) - class Foo(object): + class Foo: def __init__(self, value): self.value = value @@ -1681,7 +1681,7 @@ class LambdaElementTest( def test_cache_key_instance_variable_issue_correct_one(self): t1 = table("t1", column("q"), column("p")) - class Foo(object): + class Foo: def __init__(self, value): self.value = value @@ -1701,7 +1701,7 @@ class LambdaElementTest( def test_cache_key_instance_variable_issue_correct_two(self): t1 = table("t1", column("q"), column("p")) - class Foo(object): + class Foo: def __init__(self, value): self.value = value diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index bd9213647..e87063a90 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -354,7 +354,7 @@ class MetaDataTest(fixtures.TestBase, ComparesTables): ) def test_fk_given_non_col_clauseelem(self): - class Foo(object): + class Foo: def __clause_element__(self): return bindparam("x") @@ -379,7 +379,7 @@ class MetaDataTest(fixtures.TestBase, ComparesTables): def test_fk_given_col_non_table_clauseelem(self): t = Table("t", MetaData(), Column("x", Integer)) - class Foo(object): + class Foo: def __clause_element__(self): return t.alias().c.x @@ -2072,7 +2072,7 @@ class PKAutoIncrementTest(fixtures.TestBase): class SchemaTypeTest(fixtures.TestBase): __backend__ = True - class TrackEvents(object): + class TrackEvents: column = None table = None evt_targets = () @@ -2961,7 +2961,7 @@ class ConstraintTest(fixtures.TestBase): def test_clauseelement_extraction_one(self): t = Table("t", MetaData(), Column("x", Integer), Column("y", Integer)) - class MyThing(object): + class MyThing: def __clause_element__(self): return t.c.x + 5 @@ -2971,7 +2971,7 @@ class ConstraintTest(fixtures.TestBase): def test_clauseelement_extraction_two(self): t = Table("t", MetaData(), Column("x", Integer), Column("y", Integer)) - class MyThing(object): + class MyThing: def __clause_element__(self): return t.c.x + 5 @@ -2984,7 +2984,7 @@ class ConstraintTest(fixtures.TestBase): expr1 = t.c.x + 5 - class MyThing(object): + class MyThing: def __clause_element__(self): return expr1 @@ -3332,7 +3332,7 @@ class ConstraintTest(fixtures.TestBase): def test_column_accessor_clause_element(self): c1 = Column("x", Integer) - class CThing(object): + class CThing: def __init__(self, c): self.c = c @@ -3743,7 +3743,7 @@ class ConstraintTest(fixtures.TestBase): m = MetaData() t2 = Table("t2", m, Column("x", Integer)) - class SomeClass(object): + class SomeClass: def __clause_element__(self): return t2 @@ -3758,7 +3758,7 @@ class ConstraintTest(fixtures.TestBase): @testing.fixture def no_pickle_annotated(self): - class NoPickle(object): + class NoPickle: def __reduce__(self): raise NotImplementedError() diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 45ea30548..b86e8d075 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -449,7 +449,7 @@ class CustomUnaryOperatorTest(fixtures.TestBase, testing.AssertsCompiledSQL): ) -class _CustomComparatorTests(object): +class _CustomComparatorTests: def test_override_builtin(self): c1 = Column("foo", self._add_override_factory()) self._assert_add_override(c1) @@ -2126,7 +2126,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL): ) def test_in_arbitrary_sequence(self): - class MySeq(object): + class MySeq: def __init__(self, d): self.d = d diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py index cdc314e2f..9d4e14517 100644 --- a/test/sql/test_resultset.py +++ b/test/sql/test_resultset.py @@ -359,7 +359,7 @@ class CursorResultTest(fixtures.TablesTest): result = connection.execute(select(1)) row = result.first() - class unprintable(object): + class unprintable: def __str__(self): raise ValueError("nope") @@ -1410,7 +1410,7 @@ class CursorResultTest(fixtures.TablesTest): """ - class MyList(object): + class MyList: def __init__(self, data): self.internal_list = data @@ -2885,7 +2885,7 @@ class AlternateCursorResultTest(fixtures.TablesTest): argnames="method_name", ) def test_handle_error_in_fetch(self, strategy_cls, method_name): - class cursor(object): + class cursor: def raise_(self): raise IOError("random non-DBAPI error during cursor operation") diff --git a/test/sql/test_roles.py b/test/sql/test_roles.py index ff4f10f1a..abbef8e28 100644 --- a/test/sql/test_roles.py +++ b/test/sql/test_roles.py @@ -41,7 +41,7 @@ m = MetaData() t = Table("t", m, Column("q", Integer)) -class NotAThing1(object): +class NotAThing1: pass @@ -55,7 +55,7 @@ class NotAThing2(ClauseElement): not_a_thing2 = NotAThing2() -class NotAThing3(object): +class NotAThing3: def __clause_element__(self): return not_a_thing2 @@ -215,7 +215,7 @@ class RoleTest(fixtures.TestBase): def some_function(): pass - class Thing(object): + class Thing: def __clause_element__(self): return some_function diff --git a/test/sql/test_select.py b/test/sql/test_select.py index c9abb7fb8..f79d95a65 100644 --- a/test/sql/test_select.py +++ b/test/sql/test_select.py @@ -67,7 +67,7 @@ class FutureSelectTest(fixtures.TestBase, AssertsCompiledSQL): ) def test_new_calling_style_clauseelement_thing_that_has_iter(self): - class Thing(object): + class Thing: def __clause_element__(self): return table1 @@ -82,11 +82,11 @@ class FutureSelectTest(fixtures.TestBase, AssertsCompiledSQL): ) def test_new_calling_style_inspectable_ce_thing_that_has_iter(self): - class Thing(object): + class Thing: def __iter__(self): return iter(["a", "b", "c"]) - class InspectedThing(object): + class InspectedThing: def __clause_element__(self): return table1 diff --git a/test/sql/test_type_expressions.py b/test/sql/test_type_expressions.py index e0e0858a4..cab4f6371 100644 --- a/test/sql/test_type_expressions.py +++ b/test/sql/test_type_expressions.py @@ -14,7 +14,7 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures -class _ExprFixture(object): +class _ExprFixture: def _test_table(self, type_): test_table = Table( "test_table", MetaData(), Column("x", String), Column("y", type_) @@ -363,7 +363,7 @@ class DerivedTest(_ExprFixture, fixtures.TestBase, AssertsCompiledSQL): ) -class RoundTripTestBase(object): +class RoundTripTestBase: def test_round_trip(self, connection): connection.execute( self.tables.test_table.insert(), diff --git a/test/sql/test_types.py b/test/sql/test_types.py index d57603622..0891defc2 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -473,7 +473,7 @@ class PickleTypesTest(fixtures.TestBase): loads(dumps(meta)) -class _UserDefinedTypeFixture(object): +class _UserDefinedTypeFixture: @classmethod def define_tables(cls, metadata): class MyType(types.UserDefinedType): @@ -1064,7 +1064,7 @@ class TypeCoerceCastTest(fixtures.TablesTest): # test coerce from nulltype - e.g. use an object that # doesn't match to a known type - class MyObj(object): + class MyObj: def __str__(self): return "THISISMYOBJ" @@ -1190,7 +1190,7 @@ class TypeCoerceCastTest(fixtures.TablesTest): t = self.tables.t conn.execute(t.insert().values(data=coerce_fn("d1", MyType))) - class MyFoob(object): + class MyFoob: def __clause_element__(self): return t.c.data @@ -2323,7 +2323,7 @@ class EnumTest(AssertsCompiledSQL, fixtures.TablesTest): m1.create_all(testing.db) def test_non_native_constraint_custom_type(self): - class Foob(object): + class Foob: def __init__(self, name): self.name = name @@ -3202,7 +3202,7 @@ class ExpressionTest( class MyFoobarType(types.UserDefinedType): pass - class Foo(object): + class Foo: pass # unknown type + integer, right hand bind @@ -3315,11 +3315,11 @@ class ExpressionTest( def test_detect_coercion_of_builtins(self): @inspection._self_inspects - class SomeSQLAThing(object): + class SomeSQLAThing: def __repr__(self): return "some_sqla_thing()" - class SomeOtherThing(object): + class SomeOtherThing: pass assert_raises_message( @@ -3629,7 +3629,7 @@ class BooleanTest( ) def test_non_native_constraint_custom_type(self): - class Foob(object): + class Foob: def __init__(self, value): self.value = value diff --git a/test/sql/test_update.py b/test/sql/test_update.py index 93deae556..f59f02a7b 100644 --- a/test/sql/test_update.py +++ b/test/sql/test_update.py @@ -31,7 +31,7 @@ from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table -class _UpdateFromTestBase(object): +class _UpdateFromTestBase: @classmethod def define_tables(cls, metadata): Table( @@ -128,7 +128,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_custom_key_thing(self): table1 = self.tables.mytable - class Thing(object): + class Thing: def __clause_element__(self): return table1.c.name @@ -147,7 +147,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_ordered_custom_key_thing(self): table1 = self.tables.mytable - class Thing(object): + class Thing: def __clause_element__(self): return table1.c.name @@ -166,7 +166,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_broken_custom_key_thing(self): table1 = self.tables.mytable - class Thing(object): + class Thing: def __clause_element__(self): return 5 @@ -180,7 +180,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): def test_update_ordered_broken_custom_key_thing(self): table1 = self.tables.mytable - class Thing(object): + class Thing: def __clause_element__(self): return 5 diff --git a/test/sql/test_values.py b/test/sql/test_values.py index dcd32a679..f5ae9ea53 100644 --- a/test/sql/test_values.py +++ b/test/sql/test_values.py @@ -168,7 +168,7 @@ class ValuesTest(fixtures.TablesTest, AssertsCompiledSQL): @testing.fixture def tricky_types_parameter_fixture(self): - class SomeEnum(object): + class SomeEnum: # Implements PEP 435 in the minimal fashion needed by SQLAlchemy __members__ = OrderedDict() |
