File: test_identity_func.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 (17 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from graphql.pyutils import identity_func, Undefined


def describe_identity_func():
    def returns_the_first_argument_it_receives():
        assert identity_func() is Undefined
        assert identity_func(Undefined) is Undefined
        assert identity_func(None) is None
        obj = object()
        assert identity_func(obj) is obj

        assert identity_func(Undefined, None) is Undefined
        assert identity_func(None, Undefined) is None

        assert identity_func(None, Undefined, obj) is None
        assert identity_func(Undefined, None, obj) is Undefined
        assert identity_func(obj, None, Undefined) is obj