Modify

Ticket #27 (closed defect: worksforme)

Opened 8 years ago

Last modified 8 years ago

yaml.dump seems to be broken

Reported by: anonymous Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

I may be missing something here, but this seems to be broken:

Example that works:

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5, 'rarity': 45, 'weight': 10, 'cost': 50000, 'flags': ['INT', 'WIS', 'SPEED', 'STEALTH']})
cost: 50000
depth: 5
flags: [INT, WIS, SPEED, STEALTH]
name: The Cloak 'Colluin'
rarity: 45
weight: 10

Portion of above example:

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5})
{depth: 5, name: The Cloak 'Colluin'}

I would expect to get:

depth: 5
name: The Cloak 'Colluin'

Attachments

Change History

comment:1 Changed 8 years ago by xi

  • Status changed from new to closed
  • Resolution set to worksforme

Duplicate of #18.

It's a correct output despite the fact that the style of the nested mapping is different.

If you want collections to be always serialized in a block style, try

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5}, default_flow_style=False)
{depth: 5, name: The Cloak 'Colluin'}
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.