예제 #1
0
        def gen():
            for p in pattern:
                (name, args, op) = p
                if name == "value":
                    (v1, v2) = (args, deaccent(args))
                    if v1 != v2:
                        yield "any_of", (
                            v1,
                            v2,
                        ), op
                    else:
                        yield p
                elif name == "any_of":

                    def items():
                        for w in args:
                            (v1, v2) = (w, deaccent(w))
                            if v1 != v2:
                                yield v1
                                yield v2
                            else:
                                yield v1

                    yield "any_of", list(items()), op
                else:
                    yield p
예제 #2
0
 def items():
     for w in args:
         (v1, v2) = (w, deaccent(w))
         if v1 != v2:
             yield v1
             yield v2
         else:
             yield v1
예제 #3
0
 def test_lithuanian(self):
     assert deaccent("Šarūnas") == "Sarunas"
     assert deaccent("Kęstutis") == "Kestutis"
     assert deaccent("Ąžuolas") == "Azuolas"