summaryrefslogtreecommitdiff
path: root/tests/test_formatannotation.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_formatannotation.py')
-rw-r--r--tests/test_formatannotation.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_formatannotation.py b/tests/test_formatannotation.py
new file mode 100644
index 0000000..fd7a887
--- /dev/null
+++ b/tests/test_formatannotation.py
@@ -0,0 +1,27 @@
+try:
+ # python 2.x
+ import unittest2 as unittest
+except ImportError:
+ # python 3.x
+ import unittest
+
+import funcsigs
+
+
+class TestFormatAnnotation(unittest.TestCase):
+ def test_string (self):
+ self.assertEqual(funcsigs.formatannotation("annotation"),
+ "'annotation'")
+
+ def test_builtin_type (self):
+ self.assertEqual(funcsigs.formatannotation(int),
+ "int")
+
+ def test_user_type (self):
+ class dummy (object): pass
+ self.assertEqual(funcsigs.formatannotation(dummy),
+ "tests.test_formatannotation.dummy")
+
+
+if __name__ == "__main__":
+ unittest.begin()