Skip to content

Commit 2b83f29

Browse files
Unit tests to test str_to_bool() utility function
Signed-off-by: George J Padayatti <[email protected]>
1 parent 03843b4 commit 2b83f29

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

mydata_did/v1_0/utils/tests/__init__.py

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from asynctest import TestCase as AsyncTestCase
2+
3+
from ..util import str_to_bool
4+
5+
class TestDataAgreementV1Record(AsyncTestCase):
6+
7+
def test_str_to_bool(self):
8+
9+
assert str_to_bool("True") == True
10+
assert str_to_bool("t") == True
11+
assert str_to_bool("1") == True
12+
assert str_to_bool("true") == True
13+
14+
assert str_to_bool("False") == False
15+
assert str_to_bool("f") == False
16+
assert str_to_bool("0") == False
17+
assert str_to_bool("false") == False
18+
19+
with self.assertRaises(ValueError) as ctx:
20+
str_to_bool("")
21+
22+
self.assertTrue("Cannot convert string to boolean" in str(ctx.exception))

0 commit comments

Comments
 (0)