summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-28 11:57:46 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-28 19:30:08 -0300
commit420098145e4e6e2311e987f45c440ed01902a9cb (patch)
tree63c1f6aa65de2e19bc1d39bc082abe85109b857a
parent9c2d358942798ef6e5ef5260d15c889e9fac95ee (diff)
downloadshiboken-420098145e4e6e2311e987f45c440ed01902a9cb.tar.gz
shiboken-420098145e4e6e2311e987f45c440ed01902a9cb.tar.xz
shiboken-420098145e4e6e2311e987f45c440ed01902a9cb.zip
Created unit test for enum.__repr__ function.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--tests/samplebinding/enum_test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/samplebinding/enum_test.py b/tests/samplebinding/enum_test.py
index 698287f9..22e6b917 100644
--- a/tests/samplebinding/enum_test.py
+++ b/tests/samplebinding/enum_test.py
@@ -60,6 +60,7 @@ class EnumTest(unittest.TestCase):
'''Conversion of enum objects from Python to C++ back again.'''
enumout = SampleNamespace.enumInEnumOut(SampleNamespace.TwoIn)
self.assert_(enumout, SampleNamespace.TwoOut)
+ self.assertEqual(repr(enumout), repr(SampleNamespace.TwoOut))
def testEnumConstructorWithTooManyParameters(self):
'''Calling the constructor of non-extensible enum with the wrong number of parameters.'''
@@ -98,6 +99,15 @@ class EnumTest(unittest.TestCase):
self.assertEqual(text, repr(Event.ANY_EVENT))
+class MyEvent(Event):
+ def __init__(self):
+ Event.__init__(self, Event.EventType(999))
+
+class OutOfBoundsTest(unittest.TestCase):
+ def testValue(self):
+ e = MyEvent()
+ self.assertEqual(repr(e.eventType()), '<enum-item EventType.#out of bounds# (999)>')
+
class EnumOverloadTest(unittest.TestCase):
'''Test case for overloads involving enums'''