exclude test in Py2.4
authorStefan Behnel <stefan_ml@behnel.de>
Tue, 29 Jan 2013 06:40:03 +0000 (07:40 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Tue, 29 Jan 2013 06:40:03 +0000 (07:40 +0100)
runtests.py
tests/run/int_float_builtins_as_casts_T400.pyx
tests/run/pynumber_subtype_conversion.pyx [new file with mode: 0644]

index 8d92ec7..0cbdf63 100755 (executable)
@@ -186,6 +186,7 @@ VER_DEP_MODULES = {
                                           'run.relativeimport_T542',
                                           'run.relativeimport_star_T542',
                                           'run.initial_file_path',  # relative import
+                                          'run.pynumber_subtype_conversion',  # bug in Py2.4
                                           ]),
     (2,6) : (operator.lt, lambda x: x in ['run.print_function',
                                           'run.language_level', # print function
index beca903..c18ee01 100644 (file)
@@ -137,37 +137,3 @@ def double_to_double_int(double x):
     """
     cdef double r = int(x)
     return r
-
-
-class MyFloat(float):
-    """
-    >>> x = MyFloat(1.0)
-    >>> x
-    1.0
-    >>> float(x)
-    12.0
-    >>> x.float()
-    12.0
-    """
-    def __float__(self):
-        return 12.0
-
-    def float(self):
-        return float(self)
-
-
-class MyInt(int):
-    """
-    >>> x = MyInt(1)
-    >>> x
-    1
-    >>> int(x)
-    2
-    >>> x.int()
-    2
-    """
-    def __int__(self):
-        return 2
-
-    def int(self):
-        return int(self)
diff --git a/tests/run/pynumber_subtype_conversion.pyx b/tests/run/pynumber_subtype_conversion.pyx
new file mode 100644 (file)
index 0000000..48c00aa
--- /dev/null
@@ -0,0 +1,36 @@
+# mode: run
+# tag: python, float, builtin
+
+
+class MyFloat(float):
+    """
+    >>> x = MyFloat(1.0)
+    >>> x
+    1.0
+    >>> float(x)
+    12.0
+    >>> x.float()
+    12.0
+    """
+    def __float__(self):
+        return 12.0
+
+    def float(self):
+        return float(self)
+
+
+class MyInt(int):
+    """
+    >>> x = MyInt(1)
+    >>> x
+    1
+    >>> int(x)
+    2
+    >>> x.int()
+    2
+    """
+    def __int__(self):
+        return 2
+
+    def int(self):
+        return int(self)