From 6cc0b243d92e863a1a5098df64c24ab47cbe8895 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 4 Jun 2011 20:22:20 -0400 Subject: [PATCH] - Some unit test fixes regarding numeric arrays, MATCH operator. A potential floating-point inaccuracy issue was fixed, and certain tests of the MATCH operator only execute within an EN-oriented locale for now. [ticket:2175]. --- CHANGES | 6 ++++++ lib/sqlalchemy/test/requires.py | 6 ++++++ test/dialect/test_postgresql.py | 6 +++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 545d79bc9a..1f86681fe5 100644 --- a/CHANGES +++ b/CHANGES @@ -75,6 +75,12 @@ CHANGES would fail if against a column whose name had changed. [ticket:2141]. + - Some unit test fixes regarding numeric arrays, + MATCH operator. A potential floating-point + inaccuracy issue was fixed, and certain tests + of the MATCH operator only execute within an + EN-oriented locale for now. [ticket:2175]. + - mssql - Fixed bug in MSSQL dialect whereby the aliasing applied to a schema-qualified table would leak diff --git a/lib/sqlalchemy/test/requires.py b/lib/sqlalchemy/test/requires.py index 084eca329d..92dc6186dc 100644 --- a/lib/sqlalchemy/test/requires.py +++ b/lib/sqlalchemy/test/requires.py @@ -331,3 +331,9 @@ def sqlite(fn): skip_if(lambda: not _has_sqlite()) ) +def english_locale_on_postgresql(fn): + return _chain_decorators_on( + fn, + skip_if(lambda: testing.against('postgresql') \ + and not testing.db.scalar('SHOW LC_COLLATE').startswith('en')) + ) diff --git a/test/dialect/test_postgresql.py b/test/dialect/test_postgresql.py index 18c4477ac7..9287229934 100644 --- a/test/dialect/test_postgresql.py +++ b/test/dialect/test_postgresql.py @@ -289,7 +289,7 @@ class FloatCoercionTest(TablesTest, AssertsExecutionResults): Column('q', postgresql.ARRAY(Numeric)) ) metadata.create_all() - t1.insert().execute(x=[5], y=[5], z=[6], q=[6.4]) + t1.insert().execute(x=[5], y=[5], z=[6], q=[decimal.Decimal("6.4")]) row = t1.select().execute().first() eq_( row, @@ -2129,12 +2129,14 @@ class MatchTest(TestBase, AssertsCompiledSQL): )).execute().fetchall() eq_([3], [r.id for r in results]) + @testing.requires.english_locale_on_postgresql def test_simple_derivative_match(self): results = \ matchtable.select().where(matchtable.c.title.match('nutshells' )).execute().fetchall() eq_([5], [r.id for r in results]) + @testing.requires.english_locale_on_postgresql def test_or_match(self): results1 = \ matchtable.select().where(or_(matchtable.c.title.match('nutshells' @@ -2147,6 +2149,7 @@ class MatchTest(TestBase, AssertsCompiledSQL): )).order_by(matchtable.c.id).execute().fetchall() eq_([3, 5], [r.id for r in results2]) + @testing.requires.english_locale_on_postgresql def test_and_match(self): results1 = \ matchtable.select().where(and_(matchtable.c.title.match('python' @@ -2159,6 +2162,7 @@ class MatchTest(TestBase, AssertsCompiledSQL): )).execute().fetchall() eq_([5], [r.id for r in results2]) + @testing.requires.english_locale_on_postgresql def test_match_across_joins(self): results = matchtable.select().where(and_(cattable.c.id == matchtable.c.category_id, -- 2.47.3