def test_TypeContract_Set_Union(self):
     theirs_tc = pydoc.DocString(func_set_union).get_type_contract()
     ours_tc = pydoc.TypeContract(["set of (int or str)"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_Tuple_1(self):
     theirs_tc = pydoc.DocString(func_tuple1).get_type_contract()
     ours_tc = pydoc.TypeContract(["tuple"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_NoDocString(self):
     theirs_tc = pydoc.DocString(func_no_docstring).get_type_contract()
     ours_tc = pydoc.TypeContract(["__NONE__"], ["__NONE__"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_List_2(self):
     theirs_tc = pydoc.DocString(func_list2).get_type_contract()
     ours_tc = pydoc.TypeContract(["list of (int)"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_WrongFormat_list(self):
     theirs_tc = pydoc.DocString(func_wrong_format).get_type_contract()
     ours_tc = pydoc.TypeContract(["__ERROR__"], ["__ERROR__"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_Standard_Subclass(self):
     theirs_tc = pydoc.DocString(func_standard_subclass).get_type_contract()
     ours_tc = pydoc.TypeContract(["io.TextIOWrapper"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_Standard(self):
     theirs_tc = pydoc.DocString(func_standard).get_type_contract()
     ours_tc = pydoc.TypeContract(["int"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_Mixed1(self):
     theirs_tc = pydoc.DocString(func_mixed1).get_type_contract()
     ours_tc = pydoc.TypeContract(
         ["int", "io.TextIOWrapper", "dict", "set", "tuple"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))
 def test_TypeContract_Dict_Recursive(self):
     theirs_tc = pydoc.DocString(func_dict_recursive).get_type_contract()
     ours_tc = pydoc.TypeContract(
         ["dict of {dict of {dict: dict of {int:str}}:str}"], ["NoneType"])
     self.assertEqual(
         theirs_tc, ours_tc,
         "Type contract does not match. \"{}\" != \"{}\"".format(
             theirs_tc, ours_tc))