diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2014-02-18 10:17:38 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2014-02-18 10:17:38 +0000 |
commit | 2dd6635be7cb3f07b818eeec45e64a0b795d4e87 (patch) | |
tree | afd4740cb7e114e935ba987e164dff7dcdc4a59a /morphlib/morph2_tests.py | |
parent | a859a3377f488ef11ebed2631dbd51b2aa82afe4 (diff) | |
parent | ed0385399dbd3cfffb9af5838456efbb9183bd48 (diff) | |
download | morph-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.py | 23 |
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", |