void () { doTestByText( """ class C(object): def __enter__(self): return self def __exit__(self, exc, value, traceback): return undefined def f11(): with C(): x = 1 raise Exception() print(x) #pass def g2(): raise Exception() def f12(): with C(): <weak_warning descr="Local variable 'x' value is not used">x</weak_warning> = 2 return g2() print(x) #pass class A1(TestCase): def f3(self): with C(): x = 2 g2() print(x) #pass \s import contextlib from contextlib import suppress from unittest import TestCase def f21(): with suppress(Exception): x = 1 raise Exception() print(x) #pass def f22(): with contextlib.suppress(Exception): x = 2 return g2() print(x) #pass class A2(TestCase): def f3(self): with self.assertRaises(Exception): x = 2 g2() print(x) #pass""" ); }