[PATCH 2/6] morph2_tests: checks for python2.7 are not needed anymore

Javier Jardón javier.jardon at codethink.co.uk
Fri Jan 18 18:30:54 GMT 2013


As we use ordererdict for python < 2.7 as well
See 37f8d84d7ab356169bf7c04bdecb39a61b85c88d
---
 morphlib/morph2_tests.py | 60 ++++++++++++++++++++++--------------------------
 1 file changed, 27 insertions(+), 33 deletions(-)

diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index baa6f72..142b594 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -14,9 +14,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
-import sys
-have_python27 = sys.version_info >= (2,7)
-
 import StringIO
 import unittest
 
@@ -202,9 +199,8 @@ class MorphologyTests(unittest.TestCase):
                           Morphology,
                           text)
 
-    if have_python27:
-        def test_writing_preserves_field_order(self):
-            text = '''{
+    def test_writing_preserves_field_order(self):
+        text = '''{
     "kind": "system",
     "disk-size": 1073741824,
     "description": "Some text",
@@ -223,19 +219,18 @@ class MorphologyTests(unittest.TestCase):
         }
     ]
 }'''
-            morphology = Morphology(text)
-            output = StringIO.StringIO()
-            morphology.write_to_file(output)
+        morphology = Morphology(text)
+        output = StringIO.StringIO()
+        morphology.write_to_file(output)
 
-            text_lines = text.splitlines()
-            output_lines = output.getvalue().splitlines()
+        text_lines = text.splitlines()
+        output_lines = output.getvalue().splitlines()
 
-            # Verify that input and output are equal.
-            self.assertEqual(text_lines, output_lines)
+        # Verify that input and output are equal.
+        self.assertEqual(text_lines, output_lines)
 
-    if have_python27:
-        def test_writing_stratum_morphology_preserves_chunk_order(self):
-            text = '''{
+    def test_writing_stratum_morphology_preserves_chunk_order(self):
+        text = '''{
     "kind": "stratum",
     "chunks": [
         {
@@ -252,30 +247,29 @@ class MorphologyTests(unittest.TestCase):
         }
     ]
 }'''
-            morphology = Morphology(text)
-            output = StringIO.StringIO()
-            morphology.write_to_file(output)
+        morphology = Morphology(text)
+        output = StringIO.StringIO()
+        morphology.write_to_file(output)
 
-            text_lines = text.splitlines()
-            output_lines = output.getvalue().splitlines()
+        text_lines = text.splitlines()
+        output_lines = output.getvalue().splitlines()
 
-            # Verify that input and output are equal.
-            self.assertEqual(text_lines, output_lines)
+        # Verify that input and output are equal.
+        self.assertEqual(text_lines, output_lines)
 
-    if have_python27:
-        def test_writing_preserves_disk_size(self):
-            text = '''{
+    def test_writing_preserves_disk_size(self):
+        text = '''{
     "kind": "system",
     "disk-size": "1g",
     "arch": "x86_64",
     "system-kind": "syslinux-disk"
 }'''
-            morphology = Morphology(text)
-            output = StringIO.StringIO()
-            morphology.write_to_file(output)
+        morphology = Morphology(text)
+        output = StringIO.StringIO()
+        morphology.write_to_file(output)
 
-            text_lines = text.splitlines()
-            output_lines = output.getvalue().splitlines()
+        text_lines = text.splitlines()
+        output_lines = output.getvalue().splitlines()
 
-            # Verify that in- and output are the same.
-            self.assertEqual(text_lines, output_lines)
+        # Verify that in- and output are the same.
+        self.assertEqual(text_lines, output_lines)
-- 
1.8.0.2





More information about the baserock-dev mailing list