File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ import unittest
2
+ from fluentcheck .check import Check , CheckError
3
+
4
+
5
+ class TestDictsAssertions (unittest .TestCase ):
6
+
7
+ def test_is_dict (self ):
8
+ res = Check (dict ()).is_dict ()
9
+ self .assertIsInstance (res , Check )
10
+ try :
11
+ Check (123 ).is_dict ()
12
+ self .fail ()
13
+ except CheckError :
14
+ pass
15
+
16
+ def test_is_not_dict (self ):
17
+ res = Check (set ()).is_not_dict ()
18
+ self .assertIsInstance (res , Check )
19
+ try :
20
+ Check (dict ()).is_not_dict ()
21
+ self .fail ()
22
+ except CheckError :
23
+ pass
24
+
25
+ def test_has_keys (self ):
26
+ d = { 1 : 'one' , 2 : 'two' }
27
+ res = Check (d ).has_keys (1 ,2 )
28
+ self .assertIsInstance (res , Check )
29
+ try :
30
+ Check (d ).has_keys (3 ,4 )
31
+ self .fail ()
32
+ except CheckError :
33
+ pass
34
+
35
+ def test_has_not_keys (self ):
36
+ d = { 1 : 'one' , 2 : 'two' }
37
+ res = Check (d ).has_not_keys (3 ,4 )
38
+ self .assertIsInstance (res , Check )
39
+ try :
40
+ Check (d ).has_not_keys (1 ,2 )
41
+ self .fail ()
42
+ except CheckError :
43
+ pass
44
+
45
+
You can’t perform that action at this time.
0 commit comments