We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d19b47f commit 4cb551cCopy full SHA for 4cb551c
fluentcheck/tests/test_strings.py
@@ -0,0 +1,30 @@
1
+import unittest
2
+from fluentcheck.check import Check, CheckError
3
+
4
5
+class TestNumbersAssertions(unittest.TestCase):
6
7
+ def test_is_number(self):
8
+ # ints
9
+ val = 123
10
+ res = Check(val).is_number()
11
+ self.assertIsInstance(res, Check)
12
13
+ # floats
14
+ val = float(123)
15
16
17
18
+ # complexes
19
+ val = complex(33.44, 55.66)
20
21
22
23
+ # test failure
24
+ val = 'not-a-number'
25
+ self.assertTrue(all([not isinstance(val, kls) for kls in Check.NUMERIC_TYPES]))
26
+ try:
27
+ Check(val).is_number()
28
+ self.fail()
29
+ except CheckError:
30
+ pass
0 commit comments