I am implementing python bindings for some C++ code using pybind11. Now I am trying to write unit tests for the bindings.
There is a class A in C++ with constructor like this:
class A
{
A(std::unique_ptr<B> B_ptr);
}
It accepts a unique_ptr to an object of class B. class B is an abstract base class which can be derived. I have written bindings such that class B can be derived from Python. Is it possible for a Python mock created using unittest.mock to derive from class B so that A will accept the mock in its constructor?