summaryrefslogtreecommitdiff
path: root/tests/test_formatannotation.py
blob: fd7a8873f855cae8ebe293e44e8e05721ceef601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()