Sha256: e68fc407da56f9f9cd7a184f17d3eecbd9bbb16401e3b93544159668396af11b

Contents?: true

Size: 1.12 KB

Versions: 30

Compression:

Stored size: 1.12 KB

Contents

# Python test set -- part 2, opcodes

from test_support import *


print_test('Opcodes (test_opcodes.py)', 1)
print_test('try inside for loop', 2)

n = 0
for i in range(10):
        n = n+i
        try: 1/0
        except NameError: pass
        except ZeroDivisionError: pass
        except TypeError: pass
        try: pass
        except: pass
        try: pass
        finally: pass
        n = n+i
        
assert n == 90, 'try inside for'

print_test('raise class exceptions')

class AClass: pass
class BClass(AClass): pass
class CClass: pass
class DClass(AClass):
    def __init__(self, ignore):
        pass

try: raise AClass()
except: pass

try: raise AClass()
except AClass: pass

try: raise BClass()
except AClass: pass

try: raise BClass()
except CClass: raise TestFailed
except: pass

a = AClass()
b = BClass()

try: raise AClass, b
except BClass, v:
        assert v == b, 'class exceptions'
else: raise TestFailed

try: raise b
except AClass, v:
        assert v == b, 'class exceptions'

# not enough arguments
try:  raise BClass, a
except TypeError: pass

try:  raise DClass, a
except DClass, v:
    assert isinstance(v, DClass)

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_opcodes.py