Exemple #1
0
    def test_get_default_interaction_doc(self):
        class Action:
            """Some action."""
            pass

        def handler(wrapper, interaction):
            pass

        registry = TargetRegistry()
        registry.register_interaction(
            target_class=float,
            interaction_class=Action,
            handler=handler,
        )

        actual = registry.get_interaction_doc(
            target_class=float,
            interaction_class=Action,
        )
        self.assertEqual(actual, "Some action.")
Exemple #2
0
 def test_error_get_interaction_doc(self):
     # The registry is empty
     registry = TargetRegistry()
     with self.assertRaises(InteractionNotSupported):
         registry.get_interaction_doc(float, int)