Skip to content

Commit 01fcd42

Browse files
pfalconpi-anl
authored andcommitted
unittest: test_unittest: Add tests for expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <[email protected]>
1 parent 377ebbf commit 01fcd42

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python-stdlib/unittest/test_unittest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ def func_under_test(a):
126126
if not e1 or "not raised" not in e1.args[0]:
127127
self.fail("Expected to catch lack of AssertionError from assert in func_under_test")
128128

129+
@unittest.expectedFailure
130+
def testExpectedFailure(self):
131+
self.assertEqual(1, 0)
132+
133+
def testExpectedFailureNot(self):
134+
@unittest.expectedFailure
135+
def testInner():
136+
self.assertEqual(1, 1)
137+
138+
try:
139+
testInner()
140+
except:
141+
pass
142+
else:
143+
self.fail("Unexpected success was not detected")
144+
129145

130146
if __name__ == "__main__":
131147
unittest.main()

0 commit comments

Comments
 (0)