[test] add missing import + kill deprecation warning (closes: #1921937)
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 12 Sep 2011 16:53:28 +0200
changeset 119 751c8594cc8c
parent 118 29dc23433fec
child 120 3f788c7b4512
child 122 f77ce7b94953
[test] add missing import + kill deprecation warning (closes: #1921937)
test/unittest_descendant_of.py
--- a/test/unittest_descendant_of.py	Thu May 05 11:30:38 2011 +0200
+++ b/test/unittest_descendant_of.py	Mon Sep 12 16:53:28 2011 +0200
@@ -1,3 +1,4 @@
+from __future__ import with_statement
 from cubicweb.devtools.testlib import CubicWebTC
 
 from cubicweb import ValidationError
@@ -78,17 +79,17 @@
         self.execute('SET K3 descendant_of K0 WHERE K3 eid %(kw3)s, K0 eid %(kw0)s',
                       {'kw3': kw3.eid, 'kw0': kw0.eid})
         self.commit()
-        kw3.clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw3.descendant_of], ['kw0', 'kw1', 'kw2'])
         self.execute('SET K3 descendant_of K4 WHERE K3 eid %(kw3)s, K4 eid %(kw4)s',
                       {'kw3': kw3.eid, 'kw4': kw4.eid})
         self.commit()
-        kw3.clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw3.descendant_of], ['kw0', 'kw1', 'kw2', 'kw4'])
         self.execute('SET K3 descendant_of K5 WHERE K3 eid %(kw3)s, K5 eid %(kw5)s',
                        {'kw3': kw3.eid, 'kw5': kw5.eid})
         self.commit()
-        kw3.clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw3.descendant_of], ['kw0', 'kw1', 'kw2', 'kw4', 'kw5'])
 
     def test_keyword_update1(self):
@@ -106,12 +107,12 @@
         self.execute('SET K3 subkeyword_of K4 WHERE K3 eid %(kw3)s, K4 eid %(kw4)s',
                       {'kw3': kw3.eid, 'kw4': kw4.eid})
         self.commit()
-        kw3.clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw3.descendant_of], ['kw4'])
         self.execute('SET K3 subkeyword_of K5 WHERE K3 eid %(kw3)s, K5 eid %(kw5)s',
                      {'kw3': kw3.eid, 'kw5': kw5.eid})
         self.commit()
-        kw3.clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw3.descendant_of], ['kw4', 'kw5'])
 
     def test_keyword_descendant_of(self):
@@ -128,9 +129,9 @@
         self.execute('SET K1 subkeyword_of K0 WHERE K1 eid %(kw1)s, K0 eid %(kw0)s',
                       {'kw1': kw1.eid, 'kw0': kw0.eid})
         self.commit();
-        kw1.clear_all_caches()
-        kw2.clear_all_caches()
-        kw3.clear_all_caches()
+        kw1.cw_clear_all_caches()
+        kw2.cw_clear_all_caches()
+        kw3.cw_clear_all_caches()
         self.assertItemsEqual([kw.name for kw in kw0.cw_adapt_to('ITree').recurse_children()], ['kw1', 'kw2', 'kw3'])
         self.assertItemsEqual([kw.name for kw in kw0.reverse_descendant_of], ['kw3', 'kw2', 'kw1'])
         self.assertItemsEqual([kw.name for kw in kw1.descendant_of], ['kw0',])