MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_new_instances

Function test_new_instances

testing/test_unittest.py:131–143  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

129
130
131def test_new_instances(pytester: Pytester) -> None:
132 testpath = pytester.makepyfile(
133 """
134 import unittest
135 class MyTestCase(unittest.TestCase):
136 def test_func1(self):
137 self.x = 2
138 def test_func2(self):
139 assert not hasattr(self, 'x')
140 """
141 )
142 reprec = pytester.inline_run(testpath)
143 reprec.assertoutcome(passed=2)
144
145
146def test_function_item_obj_is_instance(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assertoutcomeMethod · 0.80
makepyfileMethod · 0.45
inline_runMethod · 0.45

Tested by

no test coverage detected