johncmerfeld commented on code in PR #43978:
URL: https://github.com/apache/airflow/pull/43978#discussion_r1853238931
##########
tests/utils/test_db.py:
##########
@@ -251,3 +252,16 @@ def test_alembic_configuration(self):
import airflow
assert config.config_file_name ==
os.path.join(os.path.dirname(airflow.__file__), "alembic.ini")
+
+ def test_bool_lazy_select_sequence(self):
+ class MockSession:
+ def __init__(self):
+ pass
+
+ def scalar(self, stmt):
+ return None
+
+ t = Table("t", MetaData(), Column("id", Integer, primary_key=True))
+ lss = LazySelectSequence.from_select(select(t.c.id), order_by=[],
session=MockSession())
+
+ assert not bool(lss)
Review Comment:
Correct, `bool(None)` returns `False`. However, the problem is that prior to
this change, `bool(lss)` returns `None`, which results in `TypeError: __bool__
should return bool, returned NoneType`, which I'm seeing in production.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]