From 2e55cf580e48b02165b7aafb0d9368c714742137 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 11 Jan 2013 17:49:55 +0100 Subject: [PATCH] Adapted test assertion against yaml dump Fixes #12914 (again). --- tests/modeltests/timezones/tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py index 2fdf6733a0..29a490e3fb 100644 --- a/tests/modeltests/timezones/tests.py +++ b/tests/modeltests/timezones/tests.py @@ -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)