[pypy-commit] pypy reflex-support: add test for operator int/long/float converter
wlav
noreply at buildbot.pypy.org
Mon Mar 25 23:44:25 CET 2013
Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r62765:9cbb25a33305
Date: 2013-03-25 11:56 -0700
http://bitbucket.org/pypy/pypy/changeset/9cbb25a33305/
Log: add test for operator int/long/float converter
diff --git a/pypy/module/cppyy/test/test_advancedcpp.py b/pypy/module/cppyy/test/test_advancedcpp.py
--- a/pypy/module/cppyy/test/test_advancedcpp.py
+++ b/pypy/module/cppyy/test/test_advancedcpp.py
@@ -591,6 +591,23 @@
assert len(a) == 1
assert a[0].m_i == 42
- # a[0] = gbl.ref_tester(33)
- # assert len(a) == 1
- # assert a[0].m_i == 33
+ # TODO:
+ # a[0] = gbl.ref_tester(33)
+ # assert len(a) == 1
+ # assert a[0].m_i == 33
+
+ def test19_math_converters(self):
+ """Test operator int/long/double incl. typedef"""
+
+ from cppyy import gbl
+
+ a = gbl.some_convertible()
+ a.m_i = 1234
+ a.m_d = 4321.
+
+ assert int(a) == 1234
+ assert int(a) == a.m_i
+ assert long(a) == a.m_i
+
+ assert float(a) == 4321.
+ assert float(a) == a.m_d
More information about the pypy-commit
mailing list