[PY3] Fix test that is flaky in Python 3

We can't rely on lists having the same order in Python3 the same
way we rely on them in Python2. If we sort them first, and then
compare them, this test will be more reliable.
This commit is contained in:
rallytime 2017-07-07 09:43:52 -06:00
parent 41ef5225e9
commit 2be4865f48

View File

@ -486,7 +486,7 @@ class TestCustomExtensions(TestCase):
env = Environment(extensions=[SerializerExtension]) env = Environment(extensions=[SerializerExtension])
if six.PY3: if six.PY3:
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset).strip("'{}").split("', '") rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset).strip("'{}").split("', '")
self.assertEqual(rendered, list(unique)) self.assertEqual(sorted(rendered), sorted(list(unique)))
else: else:
rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset) rendered = env.from_string('{{ dataset|unique }}').render(dataset=dataset)
self.assertEqual(rendered, u"{0}".format(unique)) self.assertEqual(rendered, u"{0}".format(unique))