comparison tests/test_unique.py @ 51:e1eb45c4763e

[compat] fix variable scoping for py3
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Sep 2017 18:08:55 -0700
parents 4b20694b8a16
children 5916b04d0582
comparison
equal deleted inserted replaced
50:4b20694b8a16 51:e1eb45c4763e
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2
3 """
4 test uniqueness of set elements
5 """
2 6
3 import os 7 import os
4 import unittest 8 import unittest
5 from tvii.unique import unique 9 from tvii.unique import unique
6 from tvii.unique import NotUnique 10 from tvii.unique import NotUnique
16 20
17 def test_negative(self): 21 def test_negative(self):
18 """what if a set is not unique?""" 22 """what if a set is not unique?"""
19 23
20 data = [1,2,3,4] 24 data = [1,2,3,4]
21 e = None
22 try: 25 try:
23 unique(data) 26 unique(data)
27 assert 1 == 0
24 except NotUnique as e: 28 except NotUnique as e:
25 pass 29 assert (e is not None)
26 assert e is not None 30 assert isinstance(e, NotUnique)
27 assert isinstance(e, NotUnique)
28 31
29 if __name__ == '__main__': 32 if __name__ == '__main__':
30 unittest.main() 33 unittest.main()