@@ -10,12 +10,51 @@ def test_list():
10
10
assert str (_list ) == '[String]'
11
11
12
12
13
+ def test_list_with_unmounted_type ():
14
+ with pytest .raises (Exception ) as exc_info :
15
+ List (String ())
16
+
17
+ assert str (exc_info .value ) == 'List could not have a mounted String() as inner type. Try with List(String).'
18
+
19
+
20
+ def test_list_inherited_works_list ():
21
+ _list = List (List (String ))
22
+ assert isinstance (_list .of_type , List )
23
+ assert _list .of_type .of_type == String
24
+
25
+
26
+ def test_list_inherited_works_nonnull ():
27
+ _list = List (NonNull (String ))
28
+ assert isinstance (_list .of_type , NonNull )
29
+ assert _list .of_type .of_type == String
30
+
31
+
13
32
def test_nonnull ():
14
33
nonnull = NonNull (String )
15
34
assert nonnull .of_type == String
16
35
assert str (nonnull ) == 'String!'
17
36
18
37
38
+ def test_nonnull_inherited_works_list ():
39
+ _list = NonNull (List (String ))
40
+ assert isinstance (_list .of_type , List )
41
+ assert _list .of_type .of_type == String
42
+
43
+
44
+ def test_nonnull_inherited_dont_work_nonnull ():
45
+ with pytest .raises (Exception ) as exc_info :
46
+ NonNull (NonNull (String ))
47
+
48
+ assert str (exc_info .value ) == 'Can only create NonNull of a Nullable GraphQLType but got: String!.'
49
+
50
+
51
+ def test_nonnull_with_unmounted_type ():
52
+ with pytest .raises (Exception ) as exc_info :
53
+ NonNull (String ())
54
+
55
+ assert str (exc_info .value ) == 'NonNull could not have a mounted String() as inner type. Try with NonNull(String).'
56
+
57
+
19
58
def test_list_comparasion ():
20
59
list1 = List (String )
21
60
list2 = List (String )
0 commit comments