summaryrefslogtreecommitdiff
path: root/test/engine/test_processors.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-10-11 17:56:14 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-10-12 13:39:06 -0400
commitc63658973c95996b73251e0953cf4c598cdb262b (patch)
tree1d9aba0b27f2f096369b95cf0a6dbb95f87825ac /test/engine/test_processors.py
parent3306d4d34d0f78bdda6f85a0a3be81beb2850676 (diff)
downloadsqlalchemy-c63658973c95996b73251e0953cf4c598cdb262b.tar.gz
Disallow all ambiguous boolean values for Boolean
In release 1.1, the :class:`.Boolean` type was broken in that boolean coercion via ``bool()`` would occur for backends that did not feature "native boolean", but would not occur for native boolean backends, meaning the string ``"0"`` now behaved inconsistently. After a poll, a consensus was reached that non-boolean values should be raising an error, especially in the ambiguous case of string ``"0"``; so the :class:`.Boolean` datatype will now raise ``ValueError`` if an incoming value is not within the range ``None, True, False, 1, 0``. Change-Id: If70c4f79c266f0dd1a0306c0ffe7acb9c66c4cc3 Fixes: #4102
Diffstat (limited to 'test/engine/test_processors.py')
-rw-r--r--test/engine/test_processors.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/test/engine/test_processors.py b/test/engine/test_processors.py
index 83b5a7948..9f0055e05 100644
--- a/test/engine/test_processors.py
+++ b/test/engine/test_processors.py
@@ -34,43 +34,6 @@ class _BooleanProcessorTest(fixtures.TestBase):
)
-class PyBooleanProcessorTest(_BooleanProcessorTest):
- @classmethod
- def setup_class(cls):
- from sqlalchemy import processors
- cls.module = type(
- "util", (object,),
- dict(
- (k, staticmethod(v))
- for k, v in list(processors.py_fallback().items())
- )
- )
-
- def test_bool_to_int_false(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(False), 0)
-
- def test_bool_to_int_true(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(True), 1)
-
- def test_bool_to_int_positive_int(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(5), 1)
-
- def test_bool_to_int_negative_int(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(-10), 1)
-
- def test_bool_to_int_zero(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(0), 0)
-
- def test_bool_to_int_one(self):
- from sqlalchemy import processors
- eq_(processors.boolean_to_int(1), 1)
-
-
class CBooleanProcessorTest(_BooleanProcessorTest):
__requires__ = ('cextensions',)