summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-07-26 10:28:07 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-07-26 10:28:07 +0200
commitcfe1107d4f5d8d44e2cf4f9733be145254e6c8e8 (patch)
treeaa80cc1624345afa637caa9d72d306e9e160c20e /test
parent8c9024ac95f410199372806816437488ff3f9194 (diff)
parent07f9b4ac057f646c5232781d01fc34765c1c04c2 (diff)
downloadlogilab-common-cfe1107d4f5d8d44e2cf4f9733be145254e6c8e8.tar.gz
backport stable branch
Diffstat (limited to 'test')
-rw-r--r--test/unittest_cache.py12
-rw-r--r--test/unittest_modutils.py14
2 files changed, 14 insertions, 12 deletions
diff --git a/test/unittest_cache.py b/test/unittest_cache.py
index 9b02b39..459f172 100644
--- a/test/unittest_cache.py
+++ b/test/unittest_cache.py
@@ -33,7 +33,7 @@ class CacheTestCase(TestCase):
self.assertEqual(len(self.cache._usage), 1)
self.assertEqual(self.cache._usage[-1], 1,
'1 is not the most recently used key')
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys(),
"usage list and data keys are different")
@@ -47,7 +47,7 @@ class CacheTestCase(TestCase):
"lenght of usage list is not 2")
self.assertEqual(self.cache._usage[-1], 2,
'1 is not the most recently used key')
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
def test_setitem3(self):
@@ -57,7 +57,7 @@ class CacheTestCase(TestCase):
self.assertEqual(self.cache[1], 'bar', "1 : 'bar' is not in cache.data")
self.assertEqual(len(self.cache._usage), 1, "lenght of usage list is not 1")
self.assertEqual(self.cache._usage[-1], 1, '1 is not the most recently used key')
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
def test_recycling1(self):
@@ -74,7 +74,7 @@ class CacheTestCase(TestCase):
'key 1 has not been suppressed from the cache LRU list')
self.assertEqual(len(self.cache._usage), 5, "lenght of usage list is not 5")
self.assertEqual(self.cache._usage[-1], 6, '6 is not the most recently used key')
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
def test_recycling2(self):
@@ -86,7 +86,7 @@ class CacheTestCase(TestCase):
a = self.cache[1]
self.assertEqual(a, 'foo')
self.assertEqual(self.cache._usage[-1], 1, '1 is not the most recently used key')
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
def test_delitem(self):
@@ -97,7 +97,7 @@ class CacheTestCase(TestCase):
del self.cache['foo']
self.assertTrue('foo' not in self.cache.keys(), "Element 'foo' was not removed cache dictionnary")
self.assertTrue('foo' not in self.cache._usage, "Element 'foo' was not removed usage list")
- self.assertItemsEqual(self.cache._usage,
+ self.assertCountEqual(self.cache._usage,
self.cache.keys())# usage list and data keys are different
diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py
index 3e9a74a..dfbcf14 100644
--- a/test/unittest_modutils.py
+++ b/test/unittest_modutils.py
@@ -1,4 +1,4 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
@@ -143,16 +143,16 @@ class file_from_modpath_tc(ModutilsTestCase):
corresponding file, giving priority to source file over precompiled file
if it exists"""
- def test_knownValues_file_from_modpath_1(self):
+ def test_site_packages(self):
self.assertEqual(path.realpath(modutils.file_from_modpath(['logilab', 'common', 'modutils'])),
path.realpath(modutils.__file__.replace('.pyc', '.py')))
- def test_knownValues_file_from_modpath_2(self):
+ def test_std_lib(self):
from os import path
self.assertEqual(path.realpath(modutils.file_from_modpath(['os', 'path']).replace('.pyc', '.py')),
path.realpath(path.__file__.replace('.pyc', '.py')))
- def test_knownValues_file_from_modpath_3(self):
+ def test_xmlplus(self):
try:
# don't fail if pyxml isn't installed
from xml.dom import ext
@@ -162,13 +162,15 @@ class file_from_modpath_tc(ModutilsTestCase):
self.assertEqual(path.realpath(modutils.file_from_modpath(['xml', 'dom', 'ext']).replace('.pyc', '.py')),
path.realpath(ext.__file__.replace('.pyc', '.py')))
- def test_knownValues_file_from_modpath_4(self):
+ def test_builtin(self):
self.assertEqual(modutils.file_from_modpath(['sys']),
None)
- def test_raise_file_from_modpath_Exception(self):
+
+ def test_unexisting(self):
self.assertRaises(ImportError, modutils.file_from_modpath, ['turlututu'])
+
class get_source_file_tc(ModutilsTestCase):
def test(self):