Ejemplo n.º 1
0
 def floats_without_fractional_part_are_integer():
     assert is_integer(0.0) is True
     assert is_integer(1.0) is True
     assert is_integer(-1.0) is True
     assert is_integer(10.0) is True
     assert is_integer(-10.0) is True
     assert is_integer(42.0) is True
     assert is_integer(1234567890.0) is True
     assert is_integer(-1234567890.0) is True
     assert is_integer(1e100) is True
     assert is_integer(-1e100) is True
def _coerce_long(input_value: Any) -> int:
    if not is_integer(input_value):
        raise GraphQLError('Long cannot represent non-integer value: ' +
                           inspect(input_value))
    if not MIN_LONG <= input_value <= MAX_LONG:
        raise GraphQLError(
            'Long cannot represent non 53-bit signed integer value: ' +
            inspect(input_value))
    return input_value
Ejemplo n.º 3
0
 def ints_are_integer():
     assert is_integer(0) is True
     assert is_integer(1) is True
     assert is_integer(-1) is True
     assert is_integer(42) is True
     assert is_integer(1234567890) is True
     assert is_integer(-1234567890) is True
     assert is_integer(1 >> 100) is True
Ejemplo n.º 4
0
 def object_is_not_integer():
     assert is_integer(object()) is False
Ejemplo n.º 5
0
 def undefined_is_not_integer():
     assert is_integer(Undefined) is False
Ejemplo n.º 6
0
 def inf_is_not_integer():
     assert is_integer(inf) is False
     assert is_integer(-inf) is False
Ejemplo n.º 7
0
 def null_is_not_integer():
     assert is_integer(None) is False
Ejemplo n.º 8
0
 def nan_is_not_integer():
     assert is_integer(nan) is False
Ejemplo n.º 9
0
 def complex_is_not_integer():
     assert is_integer(1j) is False
     assert is_integer(-1j) is False
     assert is_integer(42 + 1j) is False
Ejemplo n.º 10
0
 def floats_with_fractional_part_are_not_integer():
     assert is_integer(0.5) is False
     assert is_integer(1.5) is False
     assert is_integer(-1.5) is False
     assert is_integer(0.00001) is False
     assert is_integer(-0.00001) is False
     assert is_integer(1.00001) is False
     assert is_integer(-1.00001) is False
     assert is_integer(42.5) is False
     assert is_integer(10000.1) is False
     assert is_integer(-10000.1) is False
     assert is_integer(1234567890.5) is False
     assert is_integer(-1234567890.5) is False
Ejemplo n.º 11
0
 def strings_are_not_integer():
     assert is_integer("string") is False
Ejemplo n.º 12
0
 def booleans_are_not_integer():
     assert is_integer(False) is False
     assert is_integer(True) is False
Ejemplo n.º 13
0
 def undefined_is_not_integer():
     assert is_integer(INVALID) is False
Ejemplo n.º 14
0
 def strings_are_not_integer():
     assert is_integer('string') is False