diff options
| author | jonathan vanasco <jonathan@2xlp.com> | 2020-08-24 18:53:31 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-29 12:05:58 -0400 |
| commit | 672087176eaf3d0e867c6b5c67bfea3c713be42e (patch) | |
| tree | 659bc160dd94230c6fc94189617f414122de241d /test/sql | |
| parent | 317f2e1be2b06cdc12bc84510eb743d9752763dd (diff) | |
| download | sqlalchemy-672087176eaf3d0e867c6b5c67bfea3c713be42e.tar.gz | |
internal test framework files for standardization of is_not/not_in;
this is safe for 1.3.x
Change-Id: Icba38fdc20f5d8ac407383a4278ccb346e09af38
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_compare.py | 10 | ||||
| -rw-r--r-- | test/sql/test_computed.py | 4 | ||||
| -rw-r--r-- | test/sql/test_deprecations.py | 20 | ||||
| -rw-r--r-- | test/sql/test_external_traversal.py | 16 | ||||
| -rw-r--r-- | test/sql/test_operators.py | 6 | ||||
| -rw-r--r-- | test/sql/test_resultset.py | 38 | ||||
| -rw-r--r-- | test/sql/test_selectable.py | 18 | ||||
| -rw-r--r-- | test/sql/test_types.py | 6 |
8 files changed, 59 insertions, 59 deletions
diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py index 7aad2cab8..b5b6a4a52 100644 --- a/test/sql/test_compare.py +++ b/test/sql/test_compare.py @@ -68,7 +68,7 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ from sqlalchemy.testing import is_false -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not from sqlalchemy.testing import is_true from sqlalchemy.testing import ne_ from sqlalchemy.testing.util import random_choices @@ -1102,8 +1102,8 @@ class CacheKeyTest(CacheKeyFixture, CoreFixtures, fixtures.TestBase): ck2 = s2._generate_cache_key() ne_(ck1, ck2) - is_not_(ck1, None) - is_not_(ck2, None) + is_not(ck1, None) + is_not(ck2, None) def test_generative_cache_key_regen_w_del(self): t1 = table("t1", column("a"), column("b")) @@ -1124,8 +1124,8 @@ class CacheKeyTest(CacheKeyFixture, CoreFixtures, fixtures.TestBase): ck3 = s3._generate_cache_key() ne_(ck1, ck3) - is_not_(ck1, None) - is_not_(ck3, None) + is_not(ck1, None) + is_not(ck3, None) class CompareAndCopyTest(CoreFixtures, fixtures.TestBase): diff --git a/test/sql/test_computed.py b/test/sql/test_computed.py index 56aac488f..886aa13b9 100644 --- a/test/sql/test_computed.py +++ b/test/sql/test_computed.py @@ -11,7 +11,7 @@ from sqlalchemy.testing import AssertsCompiledSQL from sqlalchemy.testing import combinations from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not class DDLComputedTest(fixtures.TestBase, AssertsCompiledSQL): @@ -83,7 +83,7 @@ class DDLComputedTest(fixtures.TestBase, AssertsCompiledSQL): t2 = t.to_metadata(m2) comp2 = t2.c.y.server_default - is_not_(comp1, comp2) + is_not(comp1, comp2) is_(comp1.column, t.c.y) is_(t.c.y.server_onupdate, comp1) diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py index 871d09e04..c83c71ada 100644 --- a/test/sql/test_deprecations.py +++ b/test/sql/test_deprecations.py @@ -41,7 +41,7 @@ from sqlalchemy.testing import fixtures from sqlalchemy.testing import in_ from sqlalchemy.testing import is_true from sqlalchemy.testing import mock -from sqlalchemy.testing import not_in_ +from sqlalchemy.testing import not_in from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table @@ -991,8 +991,8 @@ class KeyTargetingTest(fixtures.TablesTest): select(content.c.type.label("content_type")) ).first() - not_in_(content.c.type, row) - not_in_(bar.c.content_type, row) + not_in(content.c.type, row) + not_in(bar.c.content_type, row) with testing.expect_deprecated( "Retrieving row values using Column objects " @@ -1003,8 +1003,8 @@ class KeyTargetingTest(fixtures.TablesTest): row = connection.execute( select(func.now().label("content_type")) ).first() - not_in_(content.c.type, row) - not_in_(bar.c.content_type, row) + not_in(content.c.type, row) + not_in(bar.c.content_type, row) with testing.expect_deprecated( "Retrieving row values using Column objects " "with only matching names" @@ -1286,7 +1286,7 @@ class CursorResultTest(fixtures.TablesTest): row = connection.execute(content.select().apply_labels()).first() in_(content.c.type, row._mapping) - not_in_(bar.c.content_type, row) + not_in(bar.c.content_type, row) with testing.expect_deprecated( "Retrieving row values using Column objects " "with only matching names" @@ -1302,7 +1302,7 @@ class CursorResultTest(fixtures.TablesTest): ): in_(content.c.type, row) - not_in_(bar.c.content_type, row) + not_in(bar.c.content_type, row) with testing.expect_deprecated( "Retrieving row values using Column objects " @@ -1314,9 +1314,9 @@ class CursorResultTest(fixtures.TablesTest): select(func.now().label("content_type")) ).first() - not_in_(content.c.type, row) + not_in(content.c.type, row) - not_in_(bar.c.content_type, row) + not_in(bar.c.content_type, row) with testing.expect_deprecated( "Retrieving row values using Column objects " @@ -1543,7 +1543,7 @@ class CursorResultTest(fixtures.TablesTest): in_("user_name", r) # no warning if the key is not there - not_in_("foobar", r) + not_in("foobar", r) # this seems to happen only with Python BaseRow # with testing.expect_deprecated( diff --git a/test/sql/test_external_traversal.py b/test/sql/test_external_traversal.py index 4918afc9c..3307f0f1e 100644 --- a/test/sql/test_external_traversal.py +++ b/test/sql/test_external_traversal.py @@ -36,7 +36,7 @@ from sqlalchemy.testing import AssertsExecutionResults from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not A = B = t1 = t2 = t3 = table1 = table2 = table3 = table4 = None @@ -447,7 +447,7 @@ class ClauseTest(fixtures.TestBase, AssertsCompiledSQL): adapter = sql_util.ColumnAdapter(t3_alias) lblx_adapted = adapter.traverse(lbl_x) - is_not_(lblx_adapted._element, lbl_x._element) + is_not(lblx_adapted._element, lbl_x._element) lblx_adapted = adapter.traverse(lbl_x) self.assert_compile( @@ -1017,7 +1017,7 @@ class ColumnAdapterTest(fixtures.TestBase, AssertsCompiledSQL): expr = select(t1a.c.col1).label("x") expr_adapted = adapter.traverse(expr) - is_not_(expr, expr_adapted) + is_not(expr, expr_adapted) is_(adapter.columns[expr], expr_adapted) def test_traverse_memoizes_w_itself(self): @@ -1026,7 +1026,7 @@ class ColumnAdapterTest(fixtures.TestBase, AssertsCompiledSQL): expr = select(t1a.c.col1).label("x") expr_adapted = adapter.traverse(expr) - is_not_(expr, expr_adapted) + is_not(expr, expr_adapted) is_(adapter.traverse(expr), expr_adapted) def test_columns_memoizes_w_itself(self): @@ -1035,7 +1035,7 @@ class ColumnAdapterTest(fixtures.TestBase, AssertsCompiledSQL): expr = select(t1a.c.col1).label("x") expr_adapted = adapter.columns[expr] - is_not_(expr, expr_adapted) + is_not(expr, expr_adapted) is_(adapter.columns[expr], expr_adapted) def test_wrapping_fallthrough(self): @@ -1112,7 +1112,7 @@ class ColumnAdapterTest(fixtures.TestBase, AssertsCompiledSQL): is_(a1_to_a2.columns[t2.c.col1], stmt2.c.table2_col1) # check that these aren't the same column - is_not_(stmt2.c.col1, stmt2.c.table2_col1) + is_not(stmt2.c.col1, stmt2.c.table2_col1) # for mutually exclusive columns, order doesn't matter is_(a2_to_a1.columns[t1.c.col1], stmt2.c.table1_col1) @@ -2031,8 +2031,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): select_copy, "SELECT table1.col1, table1.col2, " "table1.col3, yyy FROM table1", ) - is_not_(s.selected_columns, select_copy.selected_columns) - is_not_(s._raw_columns, select_copy._raw_columns) + is_not(s.selected_columns, select_copy.selected_columns) + is_not(s._raw_columns, select_copy._raw_columns) self.assert_compile( s, "SELECT table1.col1, table1.col2, " "table1.col3 FROM table1" ) diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index fcf40ebbd..7f9f6dd1e 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -57,7 +57,7 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import expect_warnings from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not from sqlalchemy.types import ARRAY from sqlalchemy.types import Boolean from sqlalchemy.types import Concatenable @@ -2129,7 +2129,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL): expr = not_(orig_expr) isinstance(expr, Label) eq_(expr.name, "foo") - is_not_(expr, orig_expr) + is_not(expr, orig_expr) is_(expr._element.operator, operator.inv) # e.g. and not false_ self.assert_compile( @@ -2143,7 +2143,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL): self.table1.c.myid == 1, self.table1.c.myid == 2 ).self_group() expr = not_(orig_expr) - is_not_(expr, orig_expr) + is_not(expr, orig_expr) self.assert_compile( expr, diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py index 428f71999..44c1565e4 100644 --- a/test/sql/test_resultset.py +++ b/test/sql/test_resultset.py @@ -45,7 +45,7 @@ from sqlalchemy.testing import is_ from sqlalchemy.testing import is_true from sqlalchemy.testing import le_ from sqlalchemy.testing import ne_ -from sqlalchemy.testing import not_in_ +from sqlalchemy.testing import not_in from sqlalchemy.testing.mock import Mock from sqlalchemy.testing.mock import patch from sqlalchemy.testing.schema import Column @@ -204,17 +204,17 @@ class CursorResultTest(fixtures.TablesTest): row = connection.execute(content.select(use_labels=True)).first() in_(content.c.type, row._mapping) - not_in_(bar.c.content_type, row._mapping) + not_in(bar.c.content_type, row._mapping) - not_in_(bar.c.content_type, row._mapping) + not_in(bar.c.content_type, row._mapping) row = connection.execute( select([func.now().label("content_type")]) ).first() - not_in_(content.c.type, row._mapping) + not_in(content.c.type, row._mapping) - not_in_(bar.c.content_type, row._mapping) + not_in(bar.c.content_type, row._mapping) def test_pickled_rows(self, connection): users = self.tables.users @@ -487,15 +487,15 @@ class CursorResultTest(fixtures.TablesTest): ).first() if testing.against("sqlite < 3.10.0"): - not_in_("user_id", r) - not_in_("user_name", r) + not_in("user_id", r) + not_in("user_name", r) eq_(r["users.user_id"], 1) eq_(r["users.user_name"], "john") eq_(list(r._fields), ["users.user_id", "users.user_name"]) else: - not_in_("users.user_id", r._mapping) - not_in_("users.user_name", r._mapping) + not_in("users.user_id", r._mapping) + not_in("users.user_name", r._mapping) eq_(r._mapping["user_id"], 1) eq_(r._mapping["user_name"], "john") @@ -522,8 +522,8 @@ class CursorResultTest(fixtures.TablesTest): eq_(r._mapping["users.user_id"], 1) eq_(r._mapping["users.user_name"], "john") else: - not_in_("users.user_id", r._mapping) - not_in_("users.user_name", r._mapping) + not_in("users.user_id", r._mapping) + not_in("users.user_name", r._mapping) eq_(list(r._fields), ["user_id", "user_name"]) @@ -542,7 +542,7 @@ class CursorResultTest(fixtures.TablesTest): ).first() eq_(r._mapping["users.user_id"], 1) eq_(r._mapping["users.user_name"], "john") - not_in_("user_name", r._mapping) + not_in("user_name", r._mapping) eq_(list(r._fields), ["users.user_id", "users.user_name"]) def test_column_accessor_unary(self, connection): @@ -692,7 +692,7 @@ class CursorResultTest(fixtures.TablesTest): in_("case_insensitive", row._keymap) in_("CaseSensitive", row._keymap) - not_in_("casesensitive", row._keymap) + not_in("casesensitive", row._keymap) eq_(row._mapping["case_insensitive"], 1) eq_(row._mapping["CaseSensitive"], 2) @@ -719,7 +719,7 @@ class CursorResultTest(fixtures.TablesTest): in_("case_insensitive", row._keymap) in_("CaseSensitive", row._keymap) - not_in_("casesensitive", row._keymap) + not_in("casesensitive", row._keymap) eq_(row._mapping["case_insensitive"], 1) eq_(row._mapping["CaseSensitive"], 2) @@ -1072,11 +1072,11 @@ class CursorResultTest(fixtures.TablesTest): eq_(keys, ["user_id", "user_name"]) ne_(keys, ["user_name", "user_id"]) in_("user_id", keys) - not_in_("foo", keys) + not_in("foo", keys) in_(users.c.user_id, keys) - not_in_(0, keys) - not_in_(addresses.c.user_id, keys) - not_in_(addresses.c.address, keys) + not_in(0, keys) + not_in(addresses.c.user_id, keys) + not_in(addresses.c.address, keys) if isinstance(obj, Row): eq_(obj._fields, ("user_id", "user_name")) @@ -1092,7 +1092,7 @@ class CursorResultTest(fixtures.TablesTest): eq_(row._fields, ("user_id", "user_name")) in_("user_id", row.keys()) - not_in_("foo", row.keys()) + not_in("foo", row.keys()) in_(users.c.user_id, row.keys()) def test_row_keys_legacy_dont_warn(self, connection): diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 58280bb67..68d79fd51 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -45,7 +45,7 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import fixtures from sqlalchemy.testing import in_ from sqlalchemy.testing import is_ -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not from sqlalchemy.testing import ne_ @@ -2601,14 +2601,14 @@ class AnnotationsTest(fixtures.TestBase): ): eq_(elem, {}) - is_not_(b2.left, bin_.left) - is_not_(b3.left, b2.left) - is_not_(b2.left, bin_.left) + is_not(b2.left, bin_.left) + is_not(b3.left, b2.left) + is_not(b2.left, bin_.left) is_(b4.left, bin_.left) # since column is immutable # deannotate copies the element - is_not_(bin_.right, b2.right) - is_not_(b2.right, b3.right) - is_not_(b3.right, b4.right) + is_not(bin_.right, b2.right) + is_not(b2.right, b3.right) + is_not(b3.right, b4.right) def test_deannotate_clone(self): table1 = table("table1", column("col1"), column("col2")) @@ -2634,8 +2634,8 @@ class AnnotationsTest(fixtures.TestBase): eq_(s3._raw_columns[0]._annotations, {}) eq_(s4._raw_columns[0]._annotations, {}) - is_not_(s3, s2) - is_not_(s4, s3) # deep deannotate makes a clone unconditionally + is_not(s3, s2) + is_not(s4, s3) # deep deannotate makes a clone unconditionally is_(s3._deannotate(), s3) # regular deannotate returns same object diff --git a/test/sql/test_types.py b/test/sql/test_types.py index b006390d4..2ede1e686 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -78,7 +78,7 @@ from sqlalchemy.testing import eq_ from sqlalchemy.testing import expect_warnings from sqlalchemy.testing import fixtures from sqlalchemy.testing import is_ -from sqlalchemy.testing import is_not_ +from sqlalchemy.testing import is_not from sqlalchemy.testing import mock from sqlalchemy.testing import pickleable from sqlalchemy.testing.schema import Column @@ -2728,12 +2728,12 @@ class ExpressionTest( expr = tab.c.avalue["foo"] == "bar" is_(expr.right.type._type_affinity, String) - is_not_(expr.right.type, my_json_normal) + is_not(expr.right.type, my_json_normal) expr = tab.c.bvalue["foo"] == "bar" is_(expr.right.type._type_affinity, String) - is_not_(expr.right.type, my_json_variant) + is_not(expr.right.type, my_json_variant) def test_variant_righthand_coercion_returns_self(self): my_datetime_normal = DateTime() |
