Exemplo n.º 1
0
    def test_Match_add(self):
        self.assertIsNone(self.match.add(general_matching.Match()))
        self.assertCountEqual(self.match.nodeid_pairs, [(2, 3), (4, 2)])
        self.assertCountEqual(
            self.match.link_pairs,
            [(Link(4, 5, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H'))])

        incompatible_match = general_matching.Match(
            [(1, 2),
             (8, 1)], [(Link(1, 8, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H'))])
        self.match.add(incompatible_match)
        self.assertCountEqual(self.match.nodeid_pairs, [(2, 3), (4, 2),
                                                        (8, 1)])
        self.assertCountEqual(
            self.match.link_pairs,
            [(Link(4, 5, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H'))])

        compatible_match = general_matching.Match(
            [(1, 5),
             (3, 4)], [(Link(1, 3, 'ARG1', 'NEQ'), Link(1, 5, 'ARG2', 'NEQ'))])
        self.match.add(compatible_match)
        self.assertCountEqual(self.match.nodeid_pairs, [(2, 3), (4, 2), (1, 5),
                                                        (8, 1), (3, 4)])
        self.assertCountEqual(
            self.match.link_pairs,
            [(Link(4, 5, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H')),
             (Link(1, 3, 'ARG1', 'NEQ'), Link(1, 5, 'ARG2', 'NEQ'))])
Exemplo n.º 2
0
 def test_Match_init(self):
     self.assertEqual(general_matching.Match().nodeid_pairs, [])
     self.assertEqual(general_matching.Match().link_pairs, [])
     self.assertCountEqual(self.match.nodeid_pairs, [(2, 3), (4, 2)])
     self.assertCountEqual(
         self.match.link_pairs,
         [(Link(4, 5, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H'))])
Exemplo n.º 3
0
 def test_Match_len(self):
     self.assertEqual(len(self.match), 3)
     self.assertEqual(len(general_matching.Match()), 0)
Exemplo n.º 4
0
 def setUp(self):
     self.match = general_matching.Match(
         [(2, 3),
          (4, 2)], [(Link(4, 5, 'RSTR', 'H'), Link(1, 2, 'RSTR', 'H'))])