Skip to content

Commit f235717

Browse files
committed
Fixed detecting when infinity is reached with multipleOf
1 parent ed1d07a commit f235717

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

CHANGELOG.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
=== UNRELEASED
2+
3+
* Updated test suite
4+
* Fixed detecting when infinity is reqched with multipleOf
5+
16
=== 2.20.0 (2024-06-15)
27

38
* Added validations at compile time:

fastjsonschema/draft04.py

+3
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ def generate_multiple_of(self):
321321
self.l('quotient = {variable} / {multipleOf}')
322322
with self.l('if int(quotient) != quotient:'):
323323
self.exc('{name} must be multiple of {multipleOf}', rule='multipleOf')
324+
# For example, 1e308 / 0.123456789
325+
with self.l('if {variable} / {multipleOf} == float("inf"):'):
326+
self.exc('inifinity reached', rule='multipleOf')
324327

325328
def generate_min_items(self):
326329
self.create_variable_is_list()

tests/json_schema/test_draft04.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def pytest_generate_tests(metafunc):
1111
'refRemote.json', # Requires local server.
1212
# Optional.
1313
'ecmascript-regex.json',
14+
'float-overflow.json',
1415
'unknown.json',
1516
'unknownKeyword.json',
1617

@@ -26,9 +27,6 @@ def pytest_generate_tests(metafunc):
2627
'minLength.json',
2728
'minProperties.json',
2829

29-
# TODO: fix big number
30-
'multipleOf.json',
31-
3230
# TODO: fix empty schema == invalid
3331
'not.json',
3432

tests/json_schema/test_draft06.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def pytest_generate_tests(metafunc):
1111
'refRemote.json', # Requires local server.
1212
# Optional.
1313
'ecmascript-regex.json',
14+
'float-overflow.json',
1415
'unknown.json',
1516
'unknownKeyword.json',
1617

@@ -26,9 +27,6 @@ def pytest_generate_tests(metafunc):
2627
'minLength.json',
2728
'minProperties.json',
2829

29-
# TODO: fix big number
30-
'multipleOf.json',
31-
3230
# TODO: fix empty schema == invalid
3331
'not.json',
3432

tests/json_schema/test_draft07.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def pytest_generate_tests(metafunc):
1111
'refRemote.json', # Requires local server.
1212
# Optional.
1313
'ecmascript-regex.json',
14+
'float-overflow.json',
1415
'idn-hostname.json',
1516
'iri.json',
1617
'unknown.json',
@@ -28,9 +29,6 @@ def pytest_generate_tests(metafunc):
2829
'minLength.json',
2930
'minProperties.json',
3031

31-
# TODO: fix big number
32-
'multipleOf.json',
33-
3432
# TODO: fix empty schema == invalid
3533
'not.json',
3634

tests/json_schema/test_draft2019.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def pytest_generate_tests(metafunc):
1111
'refRemote.json', # Requires local server.
1212
# Optional.
1313
'ecmascript-regex.json',
14+
'float-overflow.json',
1415
'idn-hostname.json',
1516
'iri.json',
1617
'unknown.json',
@@ -28,9 +29,6 @@ def pytest_generate_tests(metafunc):
2829
'minLength.json',
2930
'minProperties.json',
3031

31-
# TODO: fix big number
32-
'multipleOf.json',
33-
3432
# TODO: fix empty schema == invalid
3533
'not.json',
3634

0 commit comments

Comments
 (0)