File: test_undefined.py

package info (click to toggle)
graphql-core 3.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,384 kB
  • sloc: python: 45,812; makefile: 26; sh: 13
file content (28 lines) | stat: -rw-r--r-- 813 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from graphql.pyutils import Undefined


def describe_invalid():
    def has_repr():
        assert repr(Undefined) == "Undefined"

    def has_str():
        assert str(Undefined) == "Undefined"

    def is_hashable():
        assert hash(Undefined) == hash(Undefined)
        assert hash(Undefined) != hash(None)
        assert hash(Undefined) != hash(False)
        assert hash(Undefined) != hash(True)

    def as_bool_is_false():
        assert bool(Undefined) is False

    def only_equal_to_itself():
        assert Undefined == Undefined
        assert not Undefined != Undefined
        none_object = None
        assert Undefined != none_object
        assert not Undefined == none_object
        false_object = False
        assert Undefined != false_object
        assert not Undefined == false_object