From cc814a394045d2fde32ddaa28149c1fe9258c5d6 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 7 May 2011 15:54:05 +0200 Subject: [PATCH] Sort resources by name before combining. --- hyde/ext/plugins/combine.py | 2 +- hyde/tests/ext/test_combine.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hyde/ext/plugins/combine.py b/hyde/ext/plugins/combine.py index b005108..c4b2a82 100644 --- a/hyde/ext/plugins/combine.py +++ b/hyde/ext/plugins/combine.py @@ -55,7 +55,7 @@ class CombinePlugin(Plugin): self.logger.debug("No resources to combine for [%s]" % resource) return [] - return resources + return sorted(resources, key=lambda r: r.name) def begin_site(self): """ diff --git a/hyde/tests/ext/test_combine.py b/hyde/tests/ext/test_combine.py index 4cff807..2d3dbd8 100644 --- a/hyde/tests/ext/test_combine.py +++ b/hyde/tests/ext/test_combine.py @@ -50,8 +50,10 @@ combine: --- Last line""") - assert len(text.split("\n")) == 4 - assert text.split("\n")[-1] == "Last line" + assert text == """var a = 1 + 2; +var b = a + 3; +var c = a + 5; +Last line""" return def test_combine_bottom(self): @@ -64,8 +66,10 @@ combine: First line """) - assert len(text.split("\n")) == 4 - assert text.split("\n")[0] == "First line" + assert text == """First line +var a = 1 + 2; +var b = a + 3; +var c = a + 5;""" return def test_combine_remove(self):