Hi there,

Before opening a ticket I would like to discuss my problem here.

Django docs say:

```
YAML¶ <https://docs.djangoproject.com/en/4.0/topics/serialization/#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 
```
https://docs.djangoproject.com/en/4.0/topics/serialization/#yaml

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?

Thanks,
Sergey Fursov

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1dfa6764-a63d-4233-be5d-2f0a6bdeecdan%40googlegroups.com.
  • Yam... Sergey Fursov
    • ... Sergey Fursov
      • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
        • ... Sergey Fursov

Reply via email to