Skip to content

Test case for multipleOf plus modified test case parsing floats as decimal.Decimal #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions json/tests/draft4/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,21 @@
"valid": false
}
]
},
{
"description": "92.6 by 0.1",
"schema": {"multipleOf": 0.1},
"tests": [
{
"description": "92.6 is multiple of 0.1",
"data": 92.6,
"valid": true
},
{
"description": "92.61 is not multiple of 0.1",
"data": 92.61,
"valid": false
}
]
}
]
3 changes: 2 additions & 1 deletion jsonschema/tests/test_jsonschema_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import re
import subprocess
import sys
import decimal

try:
from sys import pypy_version_info
Expand Down Expand Up @@ -97,7 +98,7 @@ def add_test_methods(test_class):
id = itertools.count(1)

with open(filename) as test_file:
for case in json.load(test_file):
for case in json.load(test_file, parse_float=decimal.Decimal):
for test in case["tests"]:
name = "test_%s_%s_%s" % (
validating,
Expand Down