Add hooke.playlist.NoteIndexList.__str__() method.
authorW. Trevor King <wking@drexel.edu>
Sun, 16 May 2010 12:21:20 +0000 (08:21 -0400)
committerW. Trevor King <wking@drexel.edu>
Sun, 16 May 2010 12:21:20 +0000 (08:21 -0400)
Now playlists etc. will flatten themselves to strings with:
  '...%s...' % instance.

hooke/playlist.py
test/load_playlist.py

index fc4ea9a7d72649ceb2354fcbece4750da829c7d4..4cc897aa8272d23dfaccfe2847c47a48257d99b4 100644 (file)
@@ -42,6 +42,9 @@ class NoteIndexList (list):
         self.info = {}
         self._index = 0
 
+    def __str__(self):
+        return '<%s %s>' % (self.__class__.__name__, self.name)
+
     def current(self):
         if len(self) == 0:
             return None
index c94470916c8f096fb1dc7122dd2789b8a8194694..46af92eb0f1d85be966df01e9fd0667171a701eb 100644 (file)
@@ -20,7 +20,7 @@
 >>> from hooke.hooke import Hooke
 >>> h = Hooke()
 >>> h.run_lines(['load_playlist test/data/test']) # doctest: +ELLIPSIS
-[<hooke.curve.Curve object at 0x...>]
+<FilePlaylist test.hkp>
 Success
 <BLANKLINE>
 """