Skip to content

Commit 7649646

Browse files
committed
Add tests for parse_value & parse_literal of std scalars
Also make Int parsing more compatible with JS version Replicates graphql/graphql-js@2a66440
1 parent 183fd4a commit 7649646

File tree

4 files changed

+409
-6
lines changed

4 files changed

+409
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The current version 3.0.0a2 of GraphQL-core is up-to-date
1616
with GraphQL.js version 14.4.2.
1717

1818
All parts of the API are covered by an extensive test suite
19-
of currently 1907 unit tests.
19+
of currently 1917 unit tests.
2020

2121

2222
## Documentation

src/graphql/pyutils/is_finite.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66

77
def is_finite(value: Any) -> bool:
88
"""Return true if a value is a finite number."""
9-
return isinstance(value, int) or (isinstance(value, float) and isfinite(value))
9+
return (isinstance(value, int) and not isinstance(value, bool)) or (
10+
isinstance(value, float) and isfinite(value)
11+
)

tests/pyutils/test_is_finite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ def describe_is_finite():
88
def null_is_not_finite():
99
assert is_finite(None) is False
1010

11-
def booleans_are_finite():
12-
# since they are considered as integers 0 and 1
13-
assert is_finite(False) is True
14-
assert is_finite(True) is True
11+
def booleans_are_not_finite():
12+
# they should not be considered as integers 0 and 1
13+
assert is_finite(False) is False
14+
assert is_finite(True) is False
1515

1616
def strings_are_not_finite():
1717
assert is_finite("string") is False

0 commit comments

Comments
 (0)