예제 #1
0
def second_block(mesg):
    with match(mesg):
        with case(('other', _)):
            raise TestException("Exception at line 63")
        with case(('test', _)) as a:
            assert a == 1
            raise TestException("Exception at line 66")

    with match(mesg):
        with case(('other', _)):
            raise TestException("Exception at line 70")
        with case(('test', _)) as a:
            assert a == 1
            raise TestException("Exception at line 73")
예제 #2
0
 def closure():
     with match(msg):
        with case (('test', _, _)) as (a, b):
           print "CLOSURE LINE NR SHOULD BE 20", lineno()
           assert lineno() == 21
           assert (a, b) == (1, 2)
     pass
예제 #3
0
    def run(self):
        msg = ('test', 1)
        with match(msg):
            with case (('test', _)) as a:
                assert lineno() == 54
                print "wow", a

        self.Inner().process(msg)
예제 #4
0
def test(msg):
    with match(msg):
        with case (('test', _)) as a:
            print "TEST", msg
            if False:
                print "A", a
            print "LINE NR SHOULD BE 33", lineno()
            assert lineno() == 34
            print "OTHER", msg
            assert lineno() == 36
            raise TestException("let's look at the stack trace")
예제 #5
0
 def process(self, msg):
     with match(msg):
         with base(('test', _)):
             raise TestException("Exception at line 45")
         with case(('other', _)):
             raise TestException("Exception at line 47")