Tripp Lilley | a08e443 | 2013-01-18 11:30:42 -0500 | [diff] [blame] | 1 | try: |
| 2 | # python 2.x |
| 3 | import unittest2 as unittest |
| 4 | except ImportError: |
| 5 | # python 3.x |
| 6 | import unittest |
| 7 | |
| 8 | import funcsigs |
| 9 | |
| 10 | |
| 11 | class TestFormatAnnotation(unittest.TestCase): |
| 12 | def test_string (self): |
| 13 | self.assertEqual(funcsigs.formatannotation("annotation"), |
| 14 | "'annotation'") |
| 15 | |
| 16 | def test_builtin_type (self): |
| 17 | self.assertEqual(funcsigs.formatannotation(int), |
| 18 | "int") |
| 19 | |
| 20 | def test_user_type (self): |
| 21 | class dummy (object): pass |
| 22 | self.assertEqual(funcsigs.formatannotation(dummy), |
| 23 | "tests.test_formatannotation.dummy") |
| 24 | |
| 25 | |
| 26 | if __name__ == "__main__": |
| 27 | unittest.begin() |