示例#1
0
    def test_placeholder_with_methodcalling(self):
        match = Match("python")

        @match.when(_.startwith("aa"), let_="moo")
        def case1(moo):
            return moo

        @match.when(_.startswith("pyt"), let_=("a"))
        def case2(a):
            return a

        self.assertEqual(match.end, "python")
示例#2
0
    def test_placeholder_with_operator(self):
        match = Match("python")

        @match.when(_.isdigit(), let_="moo")
        def case1(moo):
            return moo

        @match.when(_ == "python", let_=("a"))
        def case2(a):
            return a

        self.assertEqual(match.end, "python")