Esempio n. 1
0
 def test_diff_method(self):
     diffs = diff_behavior(
         walk_qualname(Base, "foo"),
         walk_qualname(Derived, "foo"),
         DEFAULT_OPTIONS.overlay(max_iterations=10),
     )
     assert isinstance(diffs, list)
     self.assertEqual(
         [(d.result1.return_repr, d.result2.return_repr) for d in diffs],
         [("10", "11")],
     )
Esempio n. 2
0
 def test_diff_staticmethod(self):
     diffs = diff_behavior(
         walk_qualname(Base, "staticfoo"),
         foo2,
         DEFAULT_OPTIONS.overlay(max_iterations=10),
     )
     self.assertEqual(diffs, [])
Esempio n. 3
0
 def test_static_method(self) -> None:
     messages = analyze_any(
         walk_qualname(Person, "a_static_method"),
         AnalysisOptionSet(per_condition_timeout=5),
     )
     self.assertEqual(
         *check_messages(messages, state=MessageType.CONFIRMED))
Esempio n. 4
0
 def test_methods_directly(self) -> None:
     # Running analysis on individual methods directly works a little
     # differently, especially for staticmethod/classmethod. Confirm these
     # don't explode:
     messages = analyze_any(
         walk_qualname(Person, "a_regular_method"),
         AnalysisOptionSet(per_condition_timeout=5),
     )
     self.assertEqual(*check_messages(messages, state=MessageType.CONFIRMED))