]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fixes: #4485 Adding setter to should_evaluate_none property 4496/head
authorsanjana <sanjana0796@gmail.com>
Wed, 13 Feb 2019 06:08:00 +0000 (11:38 +0530)
committersanjana <sanjana0796@gmail.com>
Wed, 13 Feb 2019 06:08:00 +0000 (11:38 +0530)
lib/sqlalchemy/sql/sqltypes.py
test/sql/test_types.py

index 8798f5ad777f12fe82daab090b81ce88359f5c13..d23d696437f104a123c354f97b389af779983843 100644 (file)
@@ -2216,6 +2216,10 @@ class JSON(Indexable, TypeEngine):
     def should_evaluate_none(self):
         return not self.none_as_null
 
+    @should_evaluate_none.setter
+    def should_evaluate_none(self, value):
+        self.none_as_null = value
+
     @util.memoized_property
     def _str_impl(self):
         return String(_expect_unicode=True)
index dc75e1b14a7d4330d851b486a5fb1d8f4fdc5dfd..fdd3f594df1e00fc11c47c9efc4be54e6bb6c1a3 100644 (file)
@@ -249,6 +249,9 @@ class AdaptTest(fixtures.TestBase):
                         or t1.__dict__[k] is None
                     )
 
+            eval_none = t1.should_evaluate_none
+            eq_(t1.evaluates_none().should_evaluate_none, not eval_none)
+
     def test_python_type(self):
         eq_(types.Integer().python_type, int)
         eq_(types.Numeric().python_type, decimal.Decimal)