Changeset 136:0280ee006d95


Ignore:
Timestamp:
Sep 2, 2013, 3:58:35 PM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
rebase_source:
019879728c629e7709d6d4726c8edc45d0de213d
Message:

Support integer dict keys

Location:
nagslang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/tests/test_yamlish.py

    r130 r136  
    9292        })
    9393
     94    def test_int_dict(self):
     95        self.roundtrip({
     96            1: 'foo',
     97            2: 'bar',
     98            3: ['baz', 'qux'],
     99        })
     100
    94101    def test_quoted(self):
    95102        # a literal true is True, but 'true' is a string
  • nagslang/yamlish.py

    r132 r136  
    77 * ints, floats,
    88 * True, False, and None
    9 dict keys can only be strings.
     9dict keys can only be scalar.
    1010'''
    1111
     
    212212            if dm:
    213213                key, value = dm.groups()
     214                key = self._parse_value(key)
    214215                assert self._in_dict
    215216                if value:
    216                     self._container[key] = self._parse_value(value)
     217                    value = self._parse_value(value)
     218                    self._container[key] = value
    217219                else:
    218220                    self._parent_key = key
Note: See TracChangeset for help on using the changeset viewer.