Commit 9edd8452 authored by Jeremy Hylton's avatar Jeremy Hylton

Remove imports of os and sys (unneeded after framework.py removed).

Replace explicit equality tests in assert statements, which aren't
executed when running python -O, when self.assertEquals(), which also
has the side effect of producing better error messages when the test
fails.
parent 9876c565
import os,sys,unittest import unittest
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
class TestBTreesUnicode(unittest.TestCase): class TestBTreesUnicode(unittest.TestCase):
""" test unicode""" """ test unicode"""
...@@ -19,24 +18,23 @@ class TestBTreesUnicode(unittest.TestCase): ...@@ -19,24 +18,23 @@ class TestBTreesUnicode(unittest.TestCase):
(unicode('dreit\xe4gigen','latin1'), 284708391)] (unicode('dreit\xe4gigen','latin1'), 284708391)]
self.tree = OOBTree() self.tree = OOBTree()
for k,v in self.data: self.tree[k]=v for k,v in self.data:
self.tree[k]=v
def test1(self): def test1(self):
""" check every item of the tree """ """ check every item of the tree """
for k,v in self.data: for k, v in self.data:
assert self.tree[k]==v self.assertEqual(self.tree[k], v)
def test2(self): def test2(self):
""" try to access unicode keys in tree""" """ try to access unicode keys in tree"""
assert self.data[-1][0]==self.s self.assertEqual(self.data[-1][0], self.s)
assert self.tree[self.data[-1][0]] == self.data[-1][1] self.assertEqual(self.tree[self.data[-1][0]], self.data[-1][1])
assert self.tree[self.s] == self.data[-1][1] self.assertEqual(self.tree[self.s], self.data[-1][1])
def test_suite(): def test_suite():
return unittest.makeSuite(TestBTreesUnicode,'test') return unittest.makeSuite(TestBTreesUnicode, 'test')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment