[pypy-svn] pypy fast-forward: Add a test for math.trunc().

arigo commits-noreply at bitbucket.org
Thu Dec 23 16:59:41 CET 2010


Author: Armin Rigo <arigo at tunes.org>
Branch: fast-forward
Changeset: r40209:f7b055ac8d1d
Date: 2010-12-23 16:55 +0100
http://bitbucket.org/pypy/pypy/changeset/f7b055ac8d1d/

Log:	Add a test for math.trunc().

diff --git a/pypy/module/math/test/test_math.py b/pypy/module/math/test/test_math.py
--- a/pypy/module/math/test/test_math.py
+++ b/pypy/module/math/test/test_math.py
@@ -251,3 +251,12 @@
                 fail_msg += ' ({})'.format(accuracy_failure)
             failures.append(fail_msg)
         assert not failures
+
+    def test_trunc(self):
+        import math
+        assert math.trunc(1.9) == 1.0
+        raises((AttributeError, TypeError), math.trunc, 1.9j)
+        class foo(object):
+            def __trunc__(self):
+                return "truncated"
+        assert math.trunc(foo()) == "truncated"


More information about the Pypy-commit mailing list