changeset 2824:7e40c2e6d84a

tests: convert error tests to py.test
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 10 Sep 2007 21:45:30 +0200
parents 7d97003c0f9a
children 45b438c119d7
files MoinMoin/_tests/test_error.py
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_error.py	Mon Sep 10 21:34:53 2007 +0200
+++ b/MoinMoin/_tests/test_error.py	Mon Sep 10 21:45:30 2007 +0200
@@ -2,28 +2,30 @@
 """
     MoinMoin - MoinMoin.error Tests
 
-    @copyright: 2003-2004 by Nir Soffer <nirs AT freeshell DOT org>
+    @copyright: 2003-2004 by Nir Soffer <nirs AT freeshell DOT org>,
+                2007 by MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
 
-import unittest # LEGACY UNITTEST, PLEASE DO NOT IMPORT unittest IN NEW TESTS, PLEASE CONSULT THE py.test DOCS
+import py
+
 from MoinMoin import error
 
 
-class TestEncoding(unittest.TestCase):
+class TestEncoding(object):
     """ MoinMoin errors do work with unicode transparently """
 
     def testCreateWithUnicode(self):
         """ error: create with unicode """
         err = error.Error(u'טעות')
-        self.assertEqual(unicode(err), u'טעות')
-        self.assertEqual(str(err), 'טעות')
+        assert unicode(err) == u'טעות'
+        assert str(err) == 'טעות'
 
     def testCreateWithEncodedString(self):
         """ error: create with encoded string """
         err = error.Error('טעות')
-        self.assertEqual(unicode(err), u'טעות')
-        self.assertEqual(str(err), 'טעות')
+        assert unicode(err) == u'טעות'
+        assert str(err) == 'טעות'
 
     def testCreateWithObject(self):
         """ error: create with any object """
@@ -34,14 +36,14 @@
                 return 'טעות'
 
         err = error.Error(Foo())
-        self.assertEqual(unicode(err), u'טעות')
-        self.assertEqual(str(err), 'טעות')
+        assert unicode(err) == u'טעות'
+        assert str(err) == 'טעות'
 
     def testAccessLikeDict(self):
         """ error: access error like a dict """
         test = 'value'
         err = error.Error(test)
-        self.assertEqual('%(message)s' % err, test)
+        assert '%(message)s' % err == test
 
 coverage_modules = ['MoinMoin.error']