Ignore:
Timestamp:
09/02/13 14:57:59 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Rebase:
34393061663262633736346361303535343166323035393461343234306337376539663032316161
Message:

Support inline lists, dicts, etc. And alternative top level objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/tests/test_yamlish.py

    r120 r129  
    4949        self.roundtrip({'foo': 'bar'})
    5050
     51    def test_simple_list(self):
     52        self.roundtrip(['foo', 'bar'])
     53
    5154    def test_dict_of_dicts(self):
    5255        self.roundtrip({'foo': {'bar': 'baz'}})
     
    6265        })
    6366
     67    def test_list_of_lists(self):
     68        self.roundtrip(['foo', ['bar', 'baz'], 'qux'])
     69
    6470    def test_dict_list(self):
    6571        self.roundtrip({
    6672            'foo': ['bar', 'baz'],
    6773        })
     74
     75    def test_list_dict(self):
     76        self.roundtrip([
     77            {'foo': 'bar'},
     78            {'baz': 'qux', 'quux': 'corge'},
     79        ])
    6880
    6981    def test_nested_lists(self):
     
    98110
    99111
     112class TestFromPyYAMLInlineLists(TestRoundTrip):
     113    def dump_s(self, data):
     114        if yaml is None:
     115            raise SkipTest('yaml module unavailable')
     116        return yaml.dump(data)
     117
     118
    100119class TestToPyYAML(TestRoundTrip):
    101120    def load_s(self, text):
Note: See TracChangeset for help on using the changeset viewer.