Rev 4625: Each base scenario should be mirrored. in file:///home/vila/src/bzr/experimental/conflict-manager/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Mar 3 13:13:55 GMT 2010


At file:///home/vila/src/bzr/experimental/conflict-manager/

------------------------------------------------------------
revno: 4625
revision-id: v.ladeuil+lp at free.fr-20100303131355-lkivtt0s1q1ljy5t
parent: v.ladeuil+lp at free.fr-20100302133813-wzg3m9lqcxjskl7b
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: cleanup
timestamp: Wed 2010-03-03 14:13:55 +0100
message:
  Each base scenario should be mirrored.
  
  * bzrlib/tests/test_conflicts.py:
  (content_conflict_scenarios): Generate derived scenarios from base.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2010-03-02 07:38:15 +0000
+++ b/bzrlib/tests/test_conflicts.py	2010-03-03 13:13:55 +0000
@@ -210,17 +210,31 @@
 
 
 def content_conflict_scenarios():
-    return [('file,None', dict(_this_actions='modify_file',
-                               _check_this='file_has_more_content',
-                               _other_actions='delete_file',
-                               _check_other='file_doesnt_exist',
-                               )),
-            ('None,file', dict(_this_actions='delete_file',
-                               _check_this='file_doesnt_exist',
-                               _other_actions='modify_file',
-                               _check_other='file_has_more_content',
-                               )),
-            ]
+    base_scenarios = [
+        (('file', 'None'), dict(_this_actions='modify_file',
+                           _check_this='file_has_more_content',
+                           _other_actions='delete_file',
+                           _check_other='file_doesnt_exist',
+                           )),
+        ]
+    # Each base scenario is duplicated switching the roles of this and other
+    scenarios = []
+    for (t, o), d in base_scenarios:
+        scenarios.append(
+            ('%s,%s' % (t, o),
+             dict(_this_actions=d['_this_actions'],
+                  _check_this=d['_check_this'],
+                  _other_actions=['_other_actions'],
+                  _check_other=['_check_other'],
+                  )))
+        scenarios.append(
+            ('%s,%s' % (o, t),
+             dict(_this_actions=d['_other_actions'],
+                  _check_this=d['_check_other'],
+                  _other_actions=['_this_actions'],
+                  _check_other=['_check_this'],
+                  )))
+    return scenarios
 
 
 class TestResolveContentConflicts(tests.TestCaseWithTransport):



More information about the bazaar-commits mailing list