Exemplo n.º 1
0
    def test_handle_union(self):
        with self.assertRaises(RegExpParseError):
            Solver._handle_union([], [])
        with self.assertRaises(RegExpParseError):
            Solver._handle_union([1], [2, 3])

        self.assert_lists(Solver._handle_union, [None, None], [1, 2], [None],
                          [2])
        self.assert_lists(Solver._handle_union, [2, None], [4, 2], [2], [4])
        self.assert_lists(Solver._handle_union, [None, 2], [3, 3], [2], [3])
        self.assert_lists(Solver._handle_union, [5, 2], [6, 3], [5], [6])
Exemplo n.º 2
0
    def test_handle_kleene_star(self):
        with self.assertRaises(RegExpParseError):
            Solver._handle_union([], [])
        with self.assertRaises(RegExpParseError):
            Solver._handle_union([None], [])

        self.assert_lists(Solver._handle_kleene_star, [None], [2], [0], [2])
        self.assert_lists(Solver._handle_kleene_star, [0], [2], [0], [2])
        self.assert_lists(Solver._handle_kleene_star, [1], [2], [float('inf')],
                          [float('inf')])
        self.assert_lists(Solver._handle_kleene_star, [3], [3], [float('inf')],
                          [float('inf')])