diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-30 11:19:22 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-30 17:44:16 -0300 |
commit | 1eda671a34eba38e7e74e592e4ae88fa6803bcba (patch) | |
tree | a7abd551d478f100579067b948e1a17103aedcfb /tests/samplebinding/typediscovery_test.py | |
parent | 3dc673c7bcbad1613b9d3d6ff3dd4a73be41915d (diff) |
Fix the type resolver algorithm.
The new algorithm do the following:
- Try to use type_info on the object the get the object real name.
- Try to find a type resolver with the name returned by type_info.
- If a type resolver was found, get the python type.
- Else, ask binding manager to resolve the type walking on all possible
subclasses found in the inheritance tree.
The binding manager has a graph representing the class inheritance tree.
Note: This commit break the libshiboken ABI, but not the API.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.araujo@openbossa.org>
Diffstat (limited to 'tests/samplebinding/typediscovery_test.py')
-rw-r--r-- | tests/samplebinding/typediscovery_test.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/samplebinding/typediscovery_test.py b/tests/samplebinding/typediscovery_test.py index 3c1bfdb98..f7d5433ce 100644 --- a/tests/samplebinding/typediscovery_test.py +++ b/tests/samplebinding/typediscovery_test.py @@ -29,6 +29,7 @@ import unittest from sample import * +from other import * class TypeDiscoveryTest(unittest.TestCase): @@ -42,6 +43,18 @@ class TypeDiscoveryTest(unittest.TestCase): a = Derived.triggerAnotherImpossibleTypeDiscovery() self.assertEqual(type(a), Derived) + def testMultipleInheritance(self): + obj = OtherMultipleDerived.createObject("Base1"); + self.assertEqual(type(obj), Base1) + obj = OtherMultipleDerived.createObject("MDerived1"); + self.assertEqual(type(obj), MDerived1) + obj = OtherMultipleDerived.createObject("SonOfMDerived1"); + self.assertEqual(type(obj), SonOfMDerived1) + obj = OtherMultipleDerived.createObject("MDerived3"); + self.assertEqual(type(obj), MDerived3) + obj = OtherMultipleDerived.createObject("OtherMultipleDerived"); + self.assertEqual(type(obj), OtherMultipleDerived) + if __name__ == '__main__': unittest.main() |