neon-py icon indicating copy to clipboard operation
neon-py copied to clipboard

Dictionary of unindented elements is not recognized

Open tymofij opened this issue 3 years ago • 0 comments

NEON_DICT_OF_LISTS = """
key:
- "elem"
"""

def test_squeezed_dict_of_lists():
    assert neon.decode(NEON_DICT_OF_LISTS) == {"key":["elem"]}

Expected to be valid PHP

array (1)
  'key' => array (1)
     0 => 'elem'
NEON_INDENTED_DICT_OF_LISTS = """
root:
  key:
  - "elem"
"""


def test_indented_squeezed_dict_of_lists():
    assert neon.decode(NEON_INDENTED_DICT_OF_LISTS) == {"root":{"key":["elem"]}}

Expected to be valid PHP

array (1)
  'root' => array (1)
     'key' => array (1)

Although I am not sure if that is a valid Neon, or just a leniency of PHP Neon implementation

tymofij avatar Jul 16 '21 07:07 tymofij