Last change
on this file since 80 was 73, checked in by Bart Vastenhouw, 3 years ago |
Fix for IssueValue hashcode.
|
File size:
670 bytes
|
Rev | Line | |
---|
[73] | 1 | import unittest
|
---|
| 2 | from geniusweb.utils import val, HASH, toStr
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | class 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.