From 0a4125c1730a5ae595ce13650178cd15e4571e80 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 16 May 2010 08:21:20 -0400 Subject: [PATCH] Add hooke.playlist.NoteIndexList.__str__() method. Now playlists etc. will flatten themselves to strings with: '...%s...' % instance. --- hooke/playlist.py | 3 +++ test/load_playlist.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hooke/playlist.py b/hooke/playlist.py index fc4ea9a..4cc897a 100644 --- a/hooke/playlist.py +++ b/hooke/playlist.py @@ -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 diff --git a/test/load_playlist.py b/test/load_playlist.py index c944709..46af92e 100644 --- a/test/load_playlist.py +++ b/test/load_playlist.py @@ -20,7 +20,7 @@ >>> from hooke.hooke import Hooke >>> h = Hooke() >>> h.run_lines(['load_playlist test/data/test']) # doctest: +ELLIPSIS -[] + Success """ -- 2.26.2