summaryrefslogtreecommitdiff
path: root/morphlib/morph2_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-02-18 10:17:38 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2014-02-18 10:17:38 +0000
commit2dd6635be7cb3f07b818eeec45e64a0b795d4e87 (patch)
treeafd4740cb7e114e935ba987e164dff7dcdc4a59a /morphlib/morph2_tests.py
parenta859a3377f488ef11ebed2631dbd51b2aa82afe4 (diff)
parented0385399dbd3cfffb9af5838456efbb9183bd48 (diff)
downloadmorph-2dd6635be7cb3f07b818eeec45e64a0b795d4e87.tar.gz
Merge branch 'baserock/richardmaw/S10407/field-order'
Reviewed-by: Lars Wirzenius
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r--morphlib/morph2_tests.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index ba90313f..d02aab1c 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -19,6 +19,8 @@ import json
import StringIO
import unittest
+import yaml
+
import morphlib
from morphlib.morph2 import Morphology
@@ -251,19 +253,6 @@ class MorphologyTests(unittest.TestCase):
]
}'''
- def test_writing_preserves_chunk_order(self):
- text_lines = self.stratum_text.splitlines()
- text_lines[6] = ' "ref": "new-ref",'
-
- # Change one of the fields
- morphology = Morphology(self.stratum_text)
- morphology['chunks'][0]['ref'] = 'new-ref'
-
- output = StringIO.StringIO()
- morphology.update_text(self.stratum_text, output)
- output_lines = output.getvalue().splitlines()
- self.assertEqual(text_lines, output_lines)
-
def test_writing_handles_added_chunks(self):
text_lines = self.stratum_text.splitlines()
text_lines = text_lines[0:16] + text_lines[8:17] + text_lines[17:]
@@ -276,8 +265,8 @@ class MorphologyTests(unittest.TestCase):
output = StringIO.StringIO()
morphology.update_text(self.stratum_text, output)
- output_lines = output.getvalue().splitlines()
- self.assertEqual(text_lines, output_lines)
+ d = yaml.load(output.getvalue())
+ self.assertEqual(d['chunks'][2]['name'], 'baz')
def test_writing_handles_deleted_chunks(self):
text_lines = self.stratum_text.splitlines()
@@ -289,8 +278,8 @@ class MorphologyTests(unittest.TestCase):
output = StringIO.StringIO()
morphology.update_text(self.stratum_text, output)
- output_lines = output.getvalue().splitlines()
- self.assertEqual(text_lines, output_lines)
+ d = yaml.load(output.getvalue())
+ self.assertEqual(len(d['chunks']), 1)
system_text = '''{
"kind": "system",