Skip to content

Commit 968687f

Browse files
committed
Remove dead code branch for multipleOf float-to-int conversion
The encode_canonical_json call at the start of canonicalish already converts integer-valued floats to ints, making this branch unreachable.
1 parent a4d4154 commit 968687f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/hypothesis_jsonschema/_canonicalise.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,9 @@ def canonicalish(schema: JSONType) -> dict[str, Any]:
314314
for k, v in schema[key].items()
315315
}
316316
# multipleOf is semantically unaffected by the sign, so ensure it's positive.
317-
# Also normalise whole-number floats to ints for consistent isinstance checks.
317+
# Note: encode_canonical_json already converts integer-valued floats to ints.
318318
if "multipleOf" in schema:
319-
mul = abs(schema["multipleOf"])
320-
if isinstance(mul, float) and mul.is_integer():
321-
mul = int(mul)
322-
schema["multipleOf"] = mul
319+
schema["multipleOf"] = abs(schema["multipleOf"])
323320

324321
type_ = get_type(schema)
325322
if "number" in type_:

0 commit comments

Comments
 (0)