Commits

Alex Martelli  committed d59ea53

added merged-tests methods to subclass of testcase in testsupport,
used them in test_dictobject.

  • Participants
  • Parent commits d1d455b

Comments (0)

Files changed (2)

File pypy/objspace/std/test/test_dictobject.py

 from pypy.objspace.std.objspace import *
 
 
-class TestW_DictObject(unittest.TestCase):
+class TestW_DictObject(testsupport.TestCase_w):
 
     def setUp(self):
         self.space = StdObjSpace()
     def test_empty(self):
         space = self.space
         d = dobj.W_DictObject([])
-        self.failIf(space.is_true(d))
+        self.failIf_w(d)
 
     def test_nonempty(self):
         space = self.space

File pypy/objspace/std/test/testsupport.py

 import sys, os
+import unittest
 
 testdir   = os.path.dirname(os.path.abspath(__file__))
 parentdir = os.path.dirname(testdir)
 rootdir   = os.path.dirname(os.path.dirname(parentdir))
 
 sys.path.insert(0, os.path.dirname(rootdir))
+
+class TestCase_w(unittest.TestCase):
+    """ enrich TestCase with wrapped-methods """
+
+    def failUnless_w(self, condition_w, msg=None):
+        condition = self.space.is_true(condition_w)
+        return self.failUnless(condition, msg)
+
+    def failIf_w(self, condition_w, msg=None):
+        condition = self.space.is_true(condition_w)
+        return self.failIf(condition, msg)
+
+    def assertEqual_w(self, first_w, second_w, msg=None):
+        condition_w = self.space.eq(first_w, second_w)
+        condition = self.space.is_true(condition_w)
+        return self.failUnless(condition, msg)
+
+    def assertNotEqual_w(self, first_w, second_w, msg=None):
+        condition_w = self.space.eq(first_w, second_w)
+        condition = self.space.is_true(condition_w)
+        return self.failIf(condition, msg)
+