FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update test/test_with.py from CPython 3.11.2 by dalinaum · Pull Request #4648 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 9 additions & 3 deletions Lib/test/test_with.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def fooNotDeclared():
with foo: pass
self.assertRaises(NameError, fooNotDeclared)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def testEnterAttributeError1(self):
class LacksEnter(object):
def __exit__(self, type, value, traceback):
Expand All @@ -117,17 +119,21 @@ def __exit__(self, type, value, traceback):
def fooLacksEnter():
foo = LacksEnter()
with foo: pass
self.assertRaisesRegex(AttributeError, '__enter__', fooLacksEnter)
self.assertRaisesRegex(TypeError, 'the context manager', fooLacksEnter)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def testEnterAttributeError2(self):
class LacksEnterAndExit(object):
pass

def fooLacksEnterAndExit():
foo = LacksEnterAndExit()
with foo: pass
self.assertRaisesRegex(AttributeError, '__enter__', fooLacksEnterAndExit)
self.assertRaisesRegex(TypeError, 'the context manager', fooLacksEnterAndExit)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def testExitAttributeError(self):
class LacksExit(object):
def __enter__(self):
Expand All @@ -136,7 +142,7 @@ def __enter__(self):
def fooLacksExit():
foo = LacksExit()
with foo: pass
self.assertRaisesRegex(AttributeError, '__exit__', fooLacksExit)
self.assertRaisesRegex(TypeError, 'the context manager.*__exit__', fooLacksExit)

def assertRaisesSyntaxError(self, codestr):
def shouldRaiseSyntaxError(s):
Expand Down

Back | FazBrowse Home | New Git URL