Ejemplo n.º 1
0
    def test_is_admissible(self):
        arg1 = MagicMock()
        arg1.is_acceptable.return_value = True
        arg2 = MagicMock()
        arg2.is_acceptable.return_value = True
        arg3 = MagicMock()
        arg3.is_acceptable.return_value = True
        arg4 = MagicMock()
        arg5 = MagicMock()
        rel14 = MagicMock()
        rel14.relfrom = arg1
        rel14.relto   = arg4
        rel52 = MagicMock()
        rel52.relfrom = arg5
        rel52.relto   = arg2
        rel54 = MagicMock()
        rel54.relfrom = arg5
        rel54.relto   = arg4

        extension = Extension(arg1, arg4)
        self.assertFalse(extension.is_admissible([rel14]))

        extension = Extension(arg1, arg2, arg3)
        self.assertTrue(extension.is_admissible([rel14]))

        arg2.is_acceptable.return_value = False
        self.assertFalse(extension.is_admissible([rel14, rel52, rel54]))