[kupfer] plugin.rhythmbox_support: doctest for sort function



commit 7692bfa1c03e3f1af9e5b7f4fef76b4b43c5ccbb
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Aug 19 14:02:07 2009 +0200

    plugin.rhythmbox_support: doctest for sort function

 kupfer/plugin/rhythmbox_support.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/rhythmbox_support.py b/kupfer/plugin/rhythmbox_support.py
index dffc0df..96328e7 100644
--- a/kupfer/plugin/rhythmbox_support.py
+++ b/kupfer/plugin/rhythmbox_support.py
@@ -101,7 +101,17 @@ def sort_album(album):
     album.sort(key=get_track_number)
 
 def sort_album_order(songs):
-    """Sort songs in order by album then by track number"""
+    """Sort songs in order by album then by track number
+
+    >>> songs = [
+    ... {"title": "a", "album": "B", "track-number": "2"},
+    ... {"title": "b", "album": "A", "track-number": "1"},
+    ... {"title": "c", "album": "B", "track-number": "1"},
+    ... ]
+    >>> sort_album_order(songs)
+    >>> [s["title"] for s in songs]
+    ['b', 'c', 'a']
+    """
     def get_album_order(rec):
         tnr = rec.get("track-number")
         if not tnr: return None



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]