[pypy-svn] r8186 - pypy/branch/src-pytest/pypy/objspace/std/test

pedronis at codespeak.net pedronis at codespeak.net
Sun Jan 9 19:04:27 CET 2005


Author: pedronis
Date: Sun Jan  9 19:04:27 2005
New Revision: 8186

Modified:
   pypy/branch/src-pytest/pypy/objspace/std/test/test_floatobject.py
Log:
ported test_floatobject.py using utestconvert and fiximport.
will look at the others objspace/std/test tomorrow.



Modified: pypy/branch/src-pytest/pypy/objspace/std/test/test_floatobject.py
==============================================================================
--- pypy/branch/src-pytest/pypy/objspace/std/test/test_floatobject.py	(original)
+++ pypy/branch/src-pytest/pypy/objspace/std/test/test_floatobject.py	Sun Jan  9 19:04:27 2005
@@ -1,16 +1,11 @@
 import autopath
 from pypy.objspace.std import floatobject as fobj
 from pypy.objspace.std.objspace import FailedToImplement
-from pypy.tool import testit
 
-class TestW_FloatObject(testit.TestCase):
+objspacename = 'std'
 
-    def setUp(self):
-        self.space = testit.objspace('std')
+class TestW_FloatObject:
 
-    def tearDown(self):
-        pass
-    
     def _unwrap_nonimpl(self, func, *args, **kwds):
         """ make sure that the expected exception occurs, and unwrap it """
         try:
@@ -26,7 +21,7 @@
         f1 = fobj.W_FloatObject(self.space, x)
         f2 = fobj.W_FloatObject(self.space, y)
         f3 = fobj.W_FloatObject(self.space, z)
-        self.assertEquals(self.space.w_TypeError,
+        assert self.space.w_TypeError == (
                           self._unwrap_nonimpl(fobj.pow__Float_Float_ANY,
                                                self.space, f1, f2, f3))
 
@@ -36,44 +31,37 @@
         f1 = fobj.W_FloatObject(self.space, x)
         f2 = fobj.W_FloatObject(self.space, y)
         v = fobj.pow__Float_Float_ANY(self.space, f1, f2, self.space.w_None)
-        self.assertEquals(v.floatval, x ** y)
+        assert v.floatval == x ** y
         f1 = fobj.W_FloatObject(self.space, -1.23)
         f2 = fobj.W_FloatObject(self.space, -4.56)
-        self.assertEquals(self.space.w_ValueError,
+        assert self.space.w_ValueError == (
                           self._unwrap_nonimpl(fobj.pow__Float_Float_ANY,
                                                self.space, f1, f2,
                                                self.space.w_None))
 
-class AppFloatTest(testit.AppTestCase):
-    def setUp(self):
-        self.space = testit.objspace('std')
-
+class AppTestAppFloatTest:
     def test_negatives(self):
-        self.assert_(-1.1 < 0)
-        self.assert_(-0.1 < 0)
+        assert -1.1 < 0
+        assert -0.1 < 0
 
     def test_float_callable(self):
-        self.assertEquals(0.125, float(0.125))
+        assert 0.125 == float(0.125)
 
     def test_float_int(self):
-        self.assertEquals(42.0, float(42))
+        assert 42.0 == float(42)
 
     def test_float_string(self):
-        self.assertEquals(42.0, float("42"))
+        assert 42.0 == float("42")
 
     def test_round(self):
-        self.assertEquals(1.0, round(1.0))
-        self.assertEquals(1.0, round(1.1))
-        self.assertEquals(2.0, round(1.9))
-        self.assertEquals(2.0, round(1.5))
-        self.assertEquals(-2.0, round(-1.5))
-        self.assertEquals(-2.0, round(-1.5))
-        self.assertEquals(-2.0, round(-1.5, 0))
-        self.assertEquals(-2.0, round(-1.5, 0))
-        self.assertEquals(22.2, round(22.222222, 1))
-        self.assertEquals(20.0, round(22.22222, -1))
-        self.assertEquals(0.0, round(22.22222, -2))
-        
-if __name__ == '__main__':
-    testit.main()
-
+        assert 1.0 == round(1.0)
+        assert 1.0 == round(1.1)
+        assert 2.0 == round(1.9)
+        assert 2.0 == round(1.5)
+        assert -2.0 == round(-1.5)
+        assert -2.0 == round(-1.5)
+        assert -2.0 == round(-1.5, 0)
+        assert -2.0 == round(-1.5, 0)
+        assert 22.2 == round(22.222222, 1)
+        assert 20.0 == round(22.22222, -1)
+        assert 0.0 == round(22.22222, -2)



More information about the Pypy-commit mailing list