doctests for cpp wrapper
authorStefan Behnel <scoder@users.berlios.de>
Sun, 21 Feb 2010 13:46:16 +0000 (14:46 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 21 Feb 2010 13:46:16 +0000 (14:46 +0100)
tests/wrappers/cppwrap.pyx

index 1dde30a50cab4d855459559fdf4fb15b4d9a81db..6dfeced8e973058db76b47d3618cd3c355a59add 100644 (file)
@@ -2,6 +2,18 @@
 cimport cppwrap_lib
 
 cdef class DoubleKeeper:
+    """
+    >>> d = DoubleKeeper(1.0)
+    >>> d.get_number() == 1.0
+    True
+    >>> d.get_number() == 2.0
+    False
+    >>> d.set_number(2.0)
+    >>> d.get_number() == 2.0
+    True
+    >>> d.transmogrify(3.0) == 6.0
+    True
+    """
     cdef cppwrap_lib.DoubleKeeper* keeper
 
     def __cinit__(self, double number):
@@ -21,10 +33,22 @@ cdef class DoubleKeeper:
 
 
 def voidfunc():
+    """
+    >>> voidfunc()
+    """
     cppwrap_lib.voidfunc()
 
 def doublefunc(double x, double y, double z):
+    """
+    >>> doublefunc(1.0, 2.0, 3.0) == 1.0 + 2.0 + 3.0
+    True
+    """
     return cppwrap_lib.doublefunc(x, y, z)
 
 def transmogrify_from_cpp(DoubleKeeper obj not None, double value):
+    """
+    >>> d = DoubleKeeper(2.0)
+    >>> d.transmogrify(3.0) == 6.0
+    True
+    """
     return cppwrap_lib.transmogrify_from_cpp(obj.keeper, value)