1try: 2 # python 2.x 3 import unittest2 as unittest 4except ImportError: 5 # python 3.x 6 import unittest 7 8import funcsigs 9 10 11class 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 26if __name__ == "__main__": 27 unittest.begin() 28