source: geniuswebcore/test/geniusweb/utilsTest.py@ 100

Last change on this file since 100 was 100, checked in by ruud, 20 months ago

python installs also wheel to avoid error messages

File size: 670 bytes
Line 
1import unittest
2from geniusweb.utils import val, HASH, toStr
3
4
5class utilsTest (unittest.TestCase):
6 def testVal(self):
7 a:Optional[int]=None
8 self.assertRaises(ValueError, lambda:val(a))
9 a=1
10 self.assertEqual(1, val(a))
11
12
13 def testToStr(self):
14 self.assertEqual("{a=1}", toStr({'a':1}))
15 self.assertEqual("{a=1}", toStr({'a':'1'}))
16 self.assertEqual("[1, 2]", toStr([1,'2']))
17 self.assertEqual("{a=[1, 2]}", toStr({'a':[1,'2']}))
18
19 def testHASH(self):
20 HASH([1,2,3])
21 HASH((1,2,3))
22 HASH({'a':1,'b':2})
23 HASH(12)
24 HASH('12')
25 HASH(0.12)
26
Note: See TracBrowser for help on using the repository browser.