diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-19 16:32:36 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-19 16:32:36 -0500 |
| commit | 3dc9f9b3db10254f688c6b25b58951a4b1d4a41b (patch) | |
| tree | ebd64997f00c20676d898e4ebcb8f953eb3f4d14 /test/sql/test_metadata.py | |
| parent | 8e1a4fdced253a58af309c93c24a8a492b646bb7 (diff) | |
| download | sqlalchemy-3dc9f9b3db10254f688c6b25b58951a4b1d4a41b.tar.gz | |
- alter behavior such that dialect_kwargs is still immutable, but
now represents exactly the kwargs that were passed, and not the defaults.
the defaults are still in dialect_options. This allows repr() schemes such as that
of alembic to not need to look through and compare for defaults.
Diffstat (limited to 'test/sql/test_metadata.py')
| -rw-r--r-- | test/sql/test_metadata.py | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index 91a5a2600..2a52428dd 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -2089,11 +2089,13 @@ class DialectKWArgTest(fixtures.TestBase): with self._fixture(): idx = Index('a', 'b', 'c', participating_y=True) eq_( + idx.dialect_options, + {"participating": {"x": 5, "y": True, "z_one": None}} + ) + eq_( idx.dialect_kwargs, { - 'participating_z_one': None, 'participating_y': True, - 'participating_x': 5 } ) @@ -2150,21 +2152,35 @@ class DialectKWArgTest(fixtures.TestBase): with self._fixture(): idx = Index('a', 'b', 'c', unknown_y=True, unknown_z=5, otherunknown_foo='bar', participating_y=8) + eq_( + idx.dialect_options, + { + "unknown": {'y': True, 'z': 5, '*': None}, + "otherunknown": {'foo': 'bar', '*': None}, + "participating": {'x': 5, 'y': 8, 'z_one': None} + } + ) eq_(idx.dialect_kwargs, {'unknown_z': 5, 'participating_y': 8, - 'unknown_y': True, 'participating_z_one': None, - 'otherunknown_foo': 'bar', 'participating_x': 5} + 'unknown_y': True, + 'otherunknown_foo': 'bar'} ) # still populates def test_combined(self): with self._fixture(): idx = Index('a', 'b', 'c', participating_x=7, nonparticipating_y=True) + + eq_( + idx.dialect_options, + { + 'participating': {'y': False, 'x': 7, 'z_one': None}, + 'nonparticipating': {'y': True, '*': None} + } + ) eq_( idx.dialect_kwargs, { - 'participating_z_one': None, - 'participating_y': False, 'participating_x': 7, 'nonparticipating_y': True, } @@ -2178,12 +2194,16 @@ class DialectKWArgTest(fixtures.TestBase): participating2_y="lazy" ) eq_( + idx.dialect_options, + { + "participating": {'x': 7, 'y': False, 'z_one': None}, + "participating2": {'x': 15, 'y': 'lazy', 'pp': 'default'}, + } + ) + eq_( idx.dialect_kwargs, { - 'participating_z_one': None, 'participating_x': 7, - 'participating_y': False, - 'participating2_pp': 'default', 'participating2_x': 15, 'participating2_y': 'lazy' } @@ -2257,29 +2277,39 @@ class DialectKWArgTest(fixtures.TestBase): idx = Index('a', 'b', 'c', participating_x=20) eq_(idx.dialect_kwargs, { "participating_x": 20, - 'participating_z_one': None, - "participating_y": False}) + }) idx._validate_dialect_kwargs({ "participating_x": 25, "participating_z_one": "default"}) + eq_(idx.dialect_options, { + "participating": {"x": 25, "y": False, "z_one": "default"} + }) eq_(idx.dialect_kwargs, { "participating_x": 25, - 'participating_z_one': "default", - "participating_y": False}) + 'participating_z_one': "default" + }) + idx._validate_dialect_kwargs({ "participating_x": 25, "participating_z_one": "default"}) + + eq_(idx.dialect_options, { + "participating": {"x": 25, "y": False, "z_one": "default"} + }) eq_(idx.dialect_kwargs, { - 'participating_z_one': 'default', - 'participating_y': False, - 'participating_x': 25}) + "participating_x": 25, + 'participating_z_one': "default" + }) + idx._validate_dialect_kwargs({ "participating_y": True, 'participating2_y': "p2y"}) + eq_(idx.dialect_options, { + "participating": {"x": 25, "y": True, "z_one": "default"}, + "participating2": {"y": "p2y", "pp": "default", "x": 9} + }) eq_(idx.dialect_kwargs, { "participating_x": 25, - "participating2_x": 9, "participating_y": True, 'participating2_y': "p2y", - "participating2_pp": "default", "participating_z_one": "default"}) |
