Skip to content

Commit 612c048

Browse files
committed
Merge branch 'deanagan-master'
2 parents 4cb551c + 58e5ad6 commit 612c048

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

fluentcheck/tests/test_dicts.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+

0 commit comments

Comments
 (0)