MCPcopy Create free account
hub / github.com/pybind/pybind11 / test_mock_new

Function test_mock_new

tests/test_class.py:257–263  ·  view source on GitHub ↗
(mock_return_value)

Source from the content-addressed store, hash-verified

255 "mock_return_value", [None, (1, 2, 3), m.Pet("Polly", "parrot"), m.Dog("Molly")]
256)
257def test_mock_new(mock_return_value):
258 with mock.patch.object(
259 m.Pet, "__new__", return_value=mock_return_value
260 ) as mock_new:
261 obj = m.Pet("Noname", "Nospecies")
262 assert obj is mock_return_value
263 mock_new.assert_called_once_with(m.Pet, "Noname", "Nospecies")
264
265
266def test_automatic_upcasting():

Callers

nothing calls this directly

Calls 1

PetMethod · 0.45

Tested by

no test coverage detected