From e27fed1a8e7c173e0dc08e929671b9f289c3b4f1 Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Thu, 14 Apr 2011 19:49:22 -0300 Subject: Add tests for adding reverse operators. Reviewer: Luciano Wolf Marcelo Lira --- tests/samplebinding/point_test.py | 9 +++++++++ tests/samplebinding/typesystem_sample.xml | 13 +++++++++++++ 2 files changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/samplebinding/point_test.py b/tests/samplebinding/point_test.py index 752302c74..ae7cac0bb 100644 --- a/tests/samplebinding/point_test.py +++ b/tests/samplebinding/point_test.py @@ -83,6 +83,15 @@ class PointTest(unittest.TestCase): self.assertRaises(OverflowError, pt1.setXAsUint, 840835495615213080) self.assertEqual(pt1.x(), 0.0) + def testAddedOperator(self): + p = Point(0.0, 0.0) + r = p - u'Hi' + self.assertEqual(r, u'Hi') + + # now the reverse op. + r = u'Hi' - p + self.assertEqual(r, u'Hi') + if __name__ == '__main__': unittest.main() diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml index 56bfcfee3..e1837bbd3 100644 --- a/tests/samplebinding/typesystem_sample.xml +++ b/tests/samplebinding/typesystem_sample.xml @@ -1103,6 +1103,19 @@ %PYARG_0 = Py_BuildValue("(OO)", type, args); + + + %PYARG_0 = arg; + Py_INCREF(arg); + + + + + + %PYARG_0 = arg; + Py_INCREF(arg); + + -- cgit v1.2.3