Skip to content

Commit b2b2424

Browse files
Fix an errant string identity comparison in a test
Short strings can be interned as an optimization in the Python interpreter, so comparing them by identity (“is”, memory address) can succeed in practice, but it is neither correct nor reliable when comparing by equality (“==”, value) is intended.
1 parent 155f923 commit b2b2424

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/integration/validation/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def test_parameter_default_value_custom_format_invalid(self, validator_v30):
465465

466466
@oas30_format_checker.checks("custom")
467467
def validate(to_validate) -> bool:
468-
return to_validate is "valid"
468+
return to_validate == "valid"
469469

470470
spec = {
471471
"openapi": "3.0.0",

0 commit comments

Comments
 (0)