Before opening a ticket I would like to discuss my problem here.
YAML¶
YAML serialization looks quite similar to JSON. The object list is serialized
as a sequence mappings with the keys “pk”, “model” and “fields”. Each field is
again a mapping with the key being name of the field and the value the value:
- fields: {expire_date: !!timestamp '2013-01-16 08:16:59.844560+00:00'}
model: sessions.session
pk: 4b678b301dfd8a4e0dad910de3ae245b
```
But I cannot find a way to produce the same output. Both available to me environments (MacOS and Debian linux inside a Docker container) product a simpler output, like
```
>> obj = core.ModelA.objects.get(id=1)
>> print(serializers.serialize('yaml', [obj]))
- model: core.modela
pk: 1
fields:
created: 2017-02-05 16:11:44.310613+00:00
.... other fields ...
```
I've found this after running full Django test suite when 6 test from django/tests/timezones/tests.py failed. Example failure:
```
FAIL: test_naive_datetime_with_microsecond (timezones.tests.SerializationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/geyser/coding/opensource/django/tests/timezones/tests.py", line 671, in test_naive_datetime_with_microsecond
self.assert_yaml_contains_datetime(data, "2011-09-01 13:20:30.405060")
File "/Users/geyser/coding/opensource/django/tests/timezones/tests.py", line 625, in assert_yaml_contains_datetime
self.assertRegex(yaml, r"\n fields: {dt: !(!timestamp)? '%s'}" % re.escape(dt))
AssertionError: Regex didn't match: "\\n fields: {dt: !(!timestamp)? '2011\\-09\\-01\\ 13:20:30\\.405060'}" not found in '- model: timezones.event\n pk: null\n fields:\n dt: 2011-09-01 13:20:30.405060\n'
```
I've tried to install several different pyyaml versions (from 6.0 down to 5.1.2).
Do I miss something or it is a valid issue for opening a ticket?