Skip to content

Commit 3fe5a36

Browse files
authored
Merge pull request RustPython#4648 from dalinaum/test_with
Update test/test_with.py from CPython 3.11.2
2 parents f23a848 + 51fcfe9 commit 3fe5a36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Lib/test/test_with.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def fooNotDeclared():
109109
with foo: pass
110110
self.assertRaises(NameError, fooNotDeclared)
111111

112+
# TODO: RUSTPYTHON
113+
@unittest.expectedFailure
112114
def testEnterAttributeError1(self):
113115
class LacksEnter(object):
114116
def __exit__(self, type, value, traceback):
@@ -117,17 +119,21 @@ def __exit__(self, type, value, traceback):
117119
def fooLacksEnter():
118120
foo = LacksEnter()
119121
with foo: pass
120-
self.assertRaisesRegex(AttributeError, '__enter__', fooLacksEnter)
122+
self.assertRaisesRegex(TypeError, 'the context manager', fooLacksEnter)
121123

124+
# TODO: RUSTPYTHON
125+
@unittest.expectedFailure
122126
def testEnterAttributeError2(self):
123127
class LacksEnterAndExit(object):
124128
pass
125129

126130
def fooLacksEnterAndExit():
127131
foo = LacksEnterAndExit()
128132
with foo: pass
129-
self.assertRaisesRegex(AttributeError, '__enter__', fooLacksEnterAndExit)
133+
self.assertRaisesRegex(TypeError, 'the context manager', fooLacksEnterAndExit)
130134

135+
# TODO: RUSTPYTHON
136+
@unittest.expectedFailure
131137
def testExitAttributeError(self):
132138
class LacksExit(object):
133139
def __enter__(self):
@@ -136,7 +142,7 @@ def __enter__(self):
136142
def fooLacksExit():
137143
foo = LacksExit()
138144
with foo: pass
139-
self.assertRaisesRegex(AttributeError, '__exit__', fooLacksExit)
145+
self.assertRaisesRegex(TypeError, 'the context manager.*__exit__', fooLacksExit)
140146

141147
def assertRaisesSyntaxError(self, codestr):
142148
def shouldRaiseSyntaxError(s):

0 commit comments

Comments
 (0)