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

Method testNonDefaultCurrent

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

Source from the content-addressed store, hash-verified

44 self.assertIsNotNone(MyContext.current())
45
46 def testNonDefaultCurrent(self):
47 with self.assertRaises(AssertionError):
48 MyContext.current()
49
50 ctx = MyContext()
51 self.assertEqual(MyContext.current(value=ctx), ctx)
52
53 self.assertIsNone(MyContext.current(required=False))
54
55 def testDefaultCurrent(self):
56 self.assertIsInstance(DefaultMyContext.current(), DefaultMyContext)

Callers

nothing calls this directly

Calls 4

MyContextClass · 0.85
assertRaisesMethod · 0.80
currentMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected