villebro commented on code in PR #24001:
URL: https://github.com/apache/superset/pull/24001#discussion_r1191192689
##########
tests/unit_tests/utils/test_core.py:
##########
@@ -84,3 +90,26 @@ def test_remove_extra_adhoc_filters(
) -> None:
remove_extra_adhoc_filters(original)
assert expected == original
+
+
+def test_is_test():
+ orig_value = os.getenv("SUPERSET_TESTENV")
+
+ os.environ["SUPERSET_TESTENV"] = "true"
+ assert is_test()
+ os.environ["SUPERSET_TESTENV"] = "false"
+ assert not is_test()
+ os.environ["SUPERSET_TESTENV"] = ""
+ assert not is_test()
+
+ if orig_value is not None:
+ os.environ["SUPERSET_TESTENV"] = orig_value
+
+
+def test_parse_boolean_string():
+ true = ("y", "Y", "yes", "True", "t", "true", "On", "on", "1")
+ false = ("n", "N", "no", "False", "f", "false", "Off", "off", "0", "foo",
"", None)
+ for val in true:
+ assert parse_boolean_string(val)
+ for val in false:
+ assert not parse_boolean_string(val)
Review Comment:
This is a perfect candidate for `pytest.mark.parametrize` could we refactor
this test to that pattern?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]