Skip to content

Commit

Permalink
Add get_safe None comparison tests (#17411)
Browse files Browse the repository at this point in the history
* Add get_safe None comparison tests

* Fix
  • Loading branch information
AbrilRBS authored Dec 5, 2024
1 parent 4b4348f commit d366425
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/integration/options/options_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,3 +773,17 @@ def test_options_warnings(self, important):
""")
assert expected in c.out
assert "WARN: risk: There are options conflicts in the dependency graph" in c.out


def test_get_safe_none_option_checks():
tc = TestClient(light=True)
tc.save({"conanfile.py": GenConanfile("foo", "1.0")
.with_package("self.output.info(f'get_safe is None: {self.options.get_safe(\"myoption\") is None}')",
"self.output.info(f'get_safe is not None: {self.options.get_safe(\"myoption\") is not None}')",
"self.output.info(f'get_safe == None: {self.options.get_safe(\"myoption\") == None}')",
"self.output.info(f'get_safe != None: {self.options.get_safe(\"myoption\") != None}')" )})
tc.run("create .")
assert "get_safe is None: True" in tc.out
assert "get_safe is not None: False" in tc.out
assert "get_safe == None: True" in tc.out
assert "get_safe != None: False" in tc.out

0 comments on commit d366425

Please sign in to comment.