aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/duck_punching_test.py
Commit message (Collapse)AuthorAgeFilesLines
* Replaced "isUserType" test for the correct "hasCppWrapper" before method calls.Marcelo Lira2012-03-081-0/+12
| | | | | | | | Also added an unit test for infinite recursion when duck punching a virtual method. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
* BindingManager destructor now asserts if the wrapper map is empty.Marcelo Lira2010-07-271-0/+13
| | | | | | | | | | | | | The assertion is only used in debug mode. The duck punching test was altered to avoid failing when run with debug. Check the duck punching test file for a better explanation. Also added a debug helper method "showWrapperMap" to the binding manager, it shows the contents of the C pointer to Python wrapper mapping. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
* chmod -x on all tests.Hugo Parente Lima2010-06-161-0/+0
| | | | We can't run they standalone anyway, because they need some env vars to be exported like PYTHONPATH.
* Adds support for Duck Punching (aka Monkey Patching).Marcelo Lira2010-01-211-0/+139
The simplest definition of duck punching for our purposes is the ability to change the definition of a method in an instance of a class. To allow this behaviour the SbkBaseWrapper structure had to be extended with a 'ob_dict' which is a PyObject pointer to the instance dictionary. It is originally set to NULL until the user tries to access it. This dictionary could be accessed through the '__dict__' instance property. For now it is read-only. The generator was updated to handle the instance dictionary, and an extensive duck punching test was also added. Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>