Skip to content

Commit 51fcfe9

Browse files
committed
Mark failing tests of test/test_with.py
A TypeError is raised instead of an AttributeError in "with" and "async with" statements for objects which do not support the context manager or asynchronous context manager protocols correspondingly. See also: python/cpython#26809
1 parent e983506 commit 51fcfe9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_with.py

Lines changed: 6 additions & 0 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):
@@ -119,6 +121,8 @@ def fooLacksEnter():
119121
with foo: pass
120122
self.assertRaisesRegex(TypeError, 'the context manager', fooLacksEnter)
121123

124+
# TODO: RUSTPYTHON
125+
@unittest.expectedFailure
122126
def testEnterAttributeError2(self):
123127
class LacksEnterAndExit(object):
124128
pass
@@ -128,6 +132,8 @@ def fooLacksEnterAndExit():
128132
with foo: pass
129133
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):

0 commit comments

Comments
 (0)