Commits

rndblnch committed 25c6371

fixed filename & typo to make test_pep380 pass

Comments (0)

Files changed (1)

 
 diff -r 744b89eef9dd Lib/test/test_pep380.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/Lib/test/test_pep380.py	Wed Jun 29 01:00:54 2011 +0200
++++ b/Lib/test/test_pep380.py	Wed Jun 29 02:22:23 2011 +0200
 @@ -0,0 +1,1227 @@
 +# -*- coding: utf-8 -*-
 +
++
 +"""
 +Test suite for PEP 380 implementation
 +
 +             10 RETURN_VALUE         
 +"""
 +
-+    def test(self):
++    def test_1(self):
 +        try:
 +            import dis
 +            
 +Yielded 42
 +Finishing g2
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_2(self):
 +        try:
 +            def g1():
 +                print("Starting g1")
 +        self.assertEqual(self.out.getvalue(),
 +                         self.expected)
 +
-+
 +class Test3(PEP380Test):
 +    """
 +    Test raising exception in initial next() call
 +Finishing g2
 +Finishing g1
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 155, in test
++  File "{0}", line 155, in test_3
 +    for x in g1():
-+  File "test_pep380.py", line 144, in g1
++  File "{0}", line 144, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 151, in g2
++  File "{0}", line 151, in g2
 +    raise ValueError("spanish inquisition occurred")
 +ValueError: spanish inquisition occurred
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_3(self):
 +        try:
 +            def g1():
 +                try:
 +Finishing g2
 +Yielded g1 eggs
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_4(self):
 +        try:
 +            
 +            def g1():
 +Finishing g2
 +Finishing g1
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 245, in test
++  File "{0}", line 245, in test_5
 +    for x in g1():
-+  File "test_pep380.py", line 231, in g1
++  File "{0}", line 231, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 240, in g2
++  File "{0}", line 240, in g2
 +    raise ValueError("hovercraft is full of eels")
 +ValueError: hovercraft is full of eels
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_5(self):
 +        try:
 +            def g1():
 +                try:
 +Yielded g1 eggs
 +g1 received 4
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_6(self):
 +        try:
 +            def g1():
 +                print("Starting g1")
 +Yielded g2 spam
 +g2 received 2
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 353, in test
++  File "{0}", line 353, in test_7
 +    y = g.send(x)
-+  File "test_pep380.py", line 334, in g1
++  File "{0}", line 334, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 343, in g2
++  File "{0}", line 343, in g2
 +    raise ValueError("hovercraft is full of eels")
 +ValueError: hovercraft is full of eels
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_7(self):
 +        try:
 +            def g1():
 +                print("Starting g1")
 +Yielded g2 spam
 +Finishing g2
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_8(self):
 +        try:
 +            def g1():
 +                try:
 +Finishing g2
 +Finishing g1
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 452, in g2
++  File "{0}", line 452, in g2
 +    yield "g2 spam"
 +GeneratorExit
 +
 +During handling of the above exception, another exception occurred:
 +
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 462, in test
++  File "{0}", line 462, in test_9
 +    g.close()
-+  File "test_pep380.py", line 444, in g1
++  File "{0}", line 444, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 456, in g2
++  File "{0}", line 456, in g2
 +    raise ValueError("nybbles have exploded with delight")
 +ValueError: nybbles have exploded with delight
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_9(self):
 +        try:
 +            def g1():
 +                try:
 +Finishing g2
 +Finishing g1
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 515, in test
++  File "{0}", line 515, in test_10
 +    g.throw(e)
-+  File "test_pep380.py", line 497, in g1
++  File "{0}", line 497, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 505, in g2
++  File "{0}", line 505, in g2
 +    yield "g2 spam"
 +ValueError: tomato ejected
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_10(self):
 +        try:
 +            def g1():
 +                try:
 +value = spam
 +StopIteration: spam
 +value = eggs
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_11(self):
 +        try:
 +            def pex(e):
 +                print("%s: %s" % (e.__class__.__name__, e))
 +g2 returned 42
 +Yielded g1 eggs
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_12(self):
 +        try:
 +            def g1():
 +                print("Starting g1")
 +Yielded 0
 +Yielded 1
 +Yielded 2
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_13(self):
 +        try:
 +            def g():
 +                yield from range(3)
 +Yielded: 0
 +Yielded: 1
 +Yielded: 2
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_14(self):
 +        try:
 +            def g():
 +                yield from range(3)
 +    expected = """\
 +starting g
 +finishing g
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_15(self):
 +        try:
 +            def g():
 +                try:
 +Yielded 4
 +Finishing g
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 718, in test
++  File "{0}", line 718, in test_16
 +    gi.throw(e)
-+  File "test_pep380.py", line 709, in g
++  File "{0}", line 709, in g
 +    yield from range(10)
 +ValueError: tomato ejected
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_16(self):
 +        try:
 +            def g():
 +                try:
 +starting g
 +finishing g
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 754, in test
++  File "{0}", line 754, in test_17
 +    y = gi.send(42)
-+  File "test_pep380.py", line 746, in g
++  File "{0}", line 746, in g
 +    yield from range(3)
 +AttributeError: send
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_17(self):
 +        try:
 +            def g():
 +                try:
 +    expected = """\
 +g1 about to yield from g2
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 790, in test
++  File "{0}", line 790, in test_18
 +    next(gi)
-+  File "test_pep380.py", line 783, in g1
++  File "{0}", line 783, in g1
 +    yield from g2()
-+  File "test_pep380.py", line 787, in g2
++  File "{0}", line 787, in g2
 +    yield 1/0
 +ZeroDivisionError: division by zero
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_18(self):
 +        try:
 +            def g1():
 +                print("g1 about to yield from g2")
 +Yielded: y2
 +g2: about to yield from g1
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 836, in test
++  File "{0}", line 836, in test_19
 +    for y in gi:
-+  File "test_pep380.py", line 832, in g2
++  File "{0}", line 832, in g2
 +    yield from gi
-+  File "test_pep380.py", line 825, in g1
++  File "{0}", line 825, in g1
 +    yield from g2()
 +ValueError: generator already executing
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_19(self):
 +        try:
 +            def g1():
 +                print("g1: starting")
 +Yielded g2 yet more spam
 +Yielded g1 eggs
 +Finishing g1
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_20(self):
 +        try:
 +            def g1():
 +                try:
 +f resuming g
 +g returning 42
 +f caught StopIteration(42,)
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_21(self):
 +        try:
 +            def f(r):
 +                gi = g(r)
 +g received spam
 +g returning 42
 +f caught StopIteration(42,)
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_22(self):
 +        try:
 +            def f(r):
 +                gi = g(r)
 +             10 POP_TOP              
 +             11 LOAD_CONST               0 (None) 
 +             14 RETURN_VALUE         
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_23(self):
 +        try:
 +            from dis import dis
 +            
 +True
 +(257, (268, (269, (270, (271, (272, (302, (306, (307, (308, (309, (312, (313, (314, (315, (316, (317, (318, (319, (320, (1, 'f')), (322, (7, '('), (330, (331, (338, (1, 'yield'), (1, 'from'), (302, (306, (307, (308, (309, (312, (313, (314, (315, (316, (317, (318, (319, (320, (2, '1')))))))))))))))))), (8, ')')))))))))))))))))), (4, ''))), (4, ''), (0, ''))
 +True
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_24(self):
 +        try:
 +            import parser
 +            
 +inner caught ValueError
 +inner returned 2 to outer
 +2
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_25(self):
 +        try:
 +            def inner():
 +               try:
 +Enter g
 +Enter f
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 1116, in test
++  File "{0}", line 1116, in test_26
 +    gi.throw(GeneratorExit)
-+  File "test_pep380.py", line 1111, in g
++  File "{0}", line 1111, in g
 +    yield from f()
 +GeneratorExit
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_26(self):
 +        try:
 +            def f():
 +                try:
 +Enter g
 +Enter f
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 1157, in test
++  File "{0}", line 1157, in test_27
 +    gi.throw(GeneratorExit)
-+  File "test_pep380.py", line 1152, in g
++  File "{0}", line 1152, in g
 +    yield from f()
 +RuntimeError: generator ignored GeneratorExit
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_27(self):
 +        try:
 +            def f():
 +                try:
 +Enter g
 +Enter f
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 1195, in f
++  File "{0}", line 1195, in f
 +    yield
 +GeneratorExit
 +
 +During handling of the above exception, another exception occurred:
 +
 +Traceback (most recent call last):
-+  File "test_pep380.py", line 1207, in test
++  File "{0}", line 1207, in test_28
 +    gi.throw(GeneratorExit)
-+  File "test_pep380.py", line 1202, in g
++  File "{0}", line 1202, in g
 +    yield from f()
-+  File "test_pep380.py", line 1198, in f
++  File "{0}", line 1198, in f
 +    raise ValueError("Vorpal bunny encountered")
 +ValueError: Vorpal bunny encountered
-+"""
-+    def test(self):
++""".format(__file__)
++    def test_28(self):
 +        try:
 +            def f():
 +                try:
 +                    Test9, Test10, Test11, Test12, Test13, Test14, Test15,
 +                    Test16, Test17, Test18, Test19, Test20, Test21, Test22,
 +                    Test23, Test24, Test25, Test26, Test27, Test28]
-+    support.run_unitbody(*test_classes)
++    support.run_unittest(*test_classes)
 +
 +
 +if __name__ == '__main__':