From 26adbf8be1ad7b7d890b550585beaa609eddaaf2 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Thu, 27 Aug 2020 16:50:06 -0500 Subject: [PATCH] more Int tests --- graphene/types/tests/test_scalar.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/graphene/types/tests/test_scalar.py b/graphene/types/tests/test_scalar.py index db73bea8..2ff67208 100644 --- a/graphene/types/tests/test_scalar.py +++ b/graphene/types/tests/test_scalar.py @@ -1,4 +1,5 @@ from ..scalars import Scalar, Int, BigInt +from graphql.language.ast import IntValueNode def test_scalar(): @@ -11,10 +12,18 @@ def test_scalar(): def test_ints(): 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_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) - 1) is 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_literal(IntValueNode(value=str(2 ** 31 - 1))) == 2 ** 31 - 1 + assert BigInt.parse_literal(IntValueNode(value=str(2 ** 31))) == 2 ** 31