Commit 2e55cf58 authored by Claude Paroz's avatar Claude Paroz
Browse files

Adapted test assertion against yaml dump

Fixes #12914 (again).
parent 9f9a7f03
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ from __future__ import unicode_literals

import datetime
import os
import re
import sys
import time
import warnings
@@ -504,7 +505,9 @@ class SerializationTests(TestCase):
        self.assertXMLEqual(field.childNodes[0].wholeText, dt)

    def assert_yaml_contains_datetime(self, yaml, dt):
        self.assertIn("- fields: {dt: !!timestamp '%s'}" % dt, yaml)
        # Depending on the yaml dumper, '!timestamp' might be absent
        self.assertRegexpMatches(yaml,
            r"- fields: {dt: !(!timestamp)? '%s'}" % re.escape(dt))

    def test_naive_datetime(self):
        dt = datetime.datetime(2011, 9, 1, 13, 20, 30)