mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 13:59:51 +03:00
more Int tests
This commit is contained in:
parent
56614630e7
commit
26adbf8be1
|
@ -1,4 +1,5 @@
|
||||||
from ..scalars import Scalar, Int, BigInt
|
from ..scalars import Scalar, Int, BigInt
|
||||||
|
from graphql.language.ast import IntValueNode
|
||||||
|
|
||||||
|
|
||||||
def test_scalar():
|
def test_scalar():
|
||||||
|
@ -11,10 +12,18 @@ def test_scalar():
|
||||||
|
|
||||||
def test_ints():
|
def test_ints():
|
||||||
assert Int.parse_value(2 ** 31 - 1) is not None
|
assert Int.parse_value(2 ** 31 - 1) is not None
|
||||||
|
assert Int.parse_value("2.0") is not None
|
||||||
assert Int.parse_value(2 ** 31) is None
|
assert Int.parse_value(2 ** 31) is None
|
||||||
|
|
||||||
|
assert Int.parse_literal(IntValueNode(value=str(2 ** 31 - 1))) == 2 ** 31 - 1
|
||||||
|
assert Int.parse_literal(IntValueNode(value=str(2 ** 31))) is None
|
||||||
|
|
||||||
assert Int.parse_value(-(2 ** 31)) is not None
|
assert Int.parse_value(-(2 ** 31)) is not None
|
||||||
assert Int.parse_value(-(2 ** 31) - 1) is None
|
assert Int.parse_value(-(2 ** 31) - 1) is None
|
||||||
|
|
||||||
assert BigInt.parse_value(2 ** 31) is not None
|
assert BigInt.parse_value(2 ** 31) is not None
|
||||||
|
assert BigInt.parse_value("2.0") is not None
|
||||||
assert BigInt.parse_value(-(2 ** 31) - 1) is not None
|
assert BigInt.parse_value(-(2 ** 31) - 1) is not None
|
||||||
|
|
||||||
|
assert BigInt.parse_literal(IntValueNode(value=str(2 ** 31 - 1))) == 2 ** 31 - 1
|
||||||
|
assert BigInt.parse_literal(IntValueNode(value=str(2 ** 31))) == 2 ** 31
|
||||||
|
|
Loading…
Reference in New Issue
Block a user