diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-17 16:53:01 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-02-17 16:53:01 -0500 |
| commit | 2965da0a5d89119787bd45ac6f5459a7b755656d (patch) | |
| tree | a9444e1311b5b39d736ce1d248d464b95c27a9aa /lib/sqlalchemy/testing | |
| parent | bf1d03a9e58a0256db0b1f7389e23a6d11c4a964 (diff) | |
| download | sqlalchemy-2965da0a5d89119787bd45ac6f5459a7b755656d.tar.gz | |
- handle parameter sets that aren't correctly formed, so that
for example an exception object made within a test suite can
still repr (error seen in Keystone)
Diffstat (limited to 'lib/sqlalchemy/testing')
| -rw-r--r-- | lib/sqlalchemy/testing/__init__.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/assertions.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/__init__.py b/lib/sqlalchemy/testing/__init__.py index a2663b810..f4a23d238 100644 --- a/lib/sqlalchemy/testing/__init__.py +++ b/lib/sqlalchemy/testing/__init__.py @@ -22,7 +22,7 @@ from .assertions import emits_warning, emits_warning_on, uses_deprecated, \ eq_, ne_, le_, is_, is_not_, startswith_, assert_raises, \ assert_raises_message, AssertsCompiledSQL, ComparesTables, \ AssertsExecutionResults, expect_deprecated, expect_warnings, \ - in_, not_in_, eq_ignore_whitespace + in_, not_in_, eq_ignore_whitespace, eq_regex from .util import run_as_contextmanager, rowset, fail, \ provide_metadata, adict, force_drop_names, \ diff --git a/lib/sqlalchemy/testing/assertions.py b/lib/sqlalchemy/testing/assertions.py index 21f9f68fb..ea50c0738 100644 --- a/lib/sqlalchemy/testing/assertions.py +++ b/lib/sqlalchemy/testing/assertions.py @@ -204,6 +204,10 @@ def _assert_no_stray_pool_connections(): _STRAY_CONNECTION_FAILURES = 0 +def eq_regex(a, b, msg=None): + assert re.match(b, a), msg or "%r !~ %r" % (a, b) + + def eq_(a, b, msg=None): """Assert a == b, with repr messaging on failure.""" assert a == b, msg or "%r != %r" % (a, b) |
