MCPcopy Index your code
hub / github.com/pytorch/pytorch / testNestedContexts

Method testNestedContexts

caffe2/python/context_test.py:58–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56 self.assertIsInstance(DefaultMyContext.current(), DefaultMyContext)
57
58 def testNestedContexts(self):
59 with MyContext() as ctx1:
60 with DefaultMyContext() as ctx2:
61 self.assertEqual(DefaultMyContext.current(), ctx2)
62 self.assertEqual(MyContext.current(), ctx1)
63
64 def testChildClasses(self):
65 with ChildMyContext() as ctx:

Callers

nothing calls this directly

Calls 4

MyContextClass · 0.85
DefaultMyContextClass · 0.85
currentMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected