]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Some unit test fixes regarding numeric arrays,
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jun 2011 00:20:28 +0000 (20:20 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 5 Jun 2011 00:20:28 +0000 (20:20 -0400)
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].
Also in 0.6.8.

CHANGES
test/dialect/test_postgresql.py
test/lib/requires.py

diff --git a/CHANGES b/CHANGES
index 505df6394fc5bfd8cf02e26881eee89e6028c343..22e6a5d2b972ae6a3c8dfc117201738561b68ed6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -52,6 +52,14 @@ CHANGES
     versions pre-3.3.0 that did not have this 
     feature.  [ticket:2173]
 
+- postgresql
+  - 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].  
+    Also in 0.6.8.
+
 - mysql
   - Unit tests pass 100% on MySQL installed
     on windows.
index 391f12022351036ac0fa35e2b08939b9e7d2aa4e..70730983cc49c1c41d00583d76ec39b9124db664 100644 (file)
@@ -296,7 +296,7 @@ class FloatCoercionTest(fixtures.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, 
@@ -2240,12 +2240,14 @@ class MatchTest(fixtures.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'
@@ -2258,6 +2260,7 @@ class MatchTest(fixtures.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'
@@ -2270,6 +2273,7 @@ class MatchTest(fixtures.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,
index 70a2a6036663c19d9e7d7d2c0d8175eb70e370d6..640af671e90419e221f97c6bd4ebe04030644a6b 100644 (file)
@@ -404,4 +404,11 @@ def skip_mysql_on_windows(fn):
         skip_if(_has_mysql_on_windows,
             "Not supported on MySQL + Windows"
         )
-    )
\ No newline at end of file
+    )
+
+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'))
+    )