aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/samplebinding/point_test.py9
-rw-r--r--tests/samplebinding/typesystem_sample.xml13
2 files changed, 22 insertions, 0 deletions
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);
</inject-code>
</add-function>
+ <add-function signature="operator-(PyUnicode)">
+ <inject-code>
+ %PYARG_0 = arg;
+ Py_INCREF(arg);
+ </inject-code>
+ </add-function>
+ <!-- A reverse operator -->
+ <add-function signature="operator-(PyUnicode, Point)">
+ <inject-code>
+ %PYARG_0 = arg;
+ Py_INCREF(arg);
+ </inject-code>
+ </add-function>
</value-type>
<value-type name="PointF">