diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-09-15 14:23:38 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-09-15 14:23:38 +0100 |
commit | 154d6f417cea336cbbefbc8478377670e96dd546 (patch) | |
tree | 6a7e578041e7fc0d536bc1deacc5f2d96aedb617 | |
parent | 4d1e622155ccd3cd1b945e9b6e572d66372e7446 (diff) | |
download | python-ttystatus-154d6f417cea336cbbefbc8478377670e96dd546.tar.gz |
Fix String to handle non-string values.
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | ttystatus/string.py | 2 | ||||
-rw-r--r-- | ttystatus/string_tests.py | 4 |
3 files changed, 10 insertions, 1 deletions
@@ -1,6 +1,11 @@ NEWS file for ttystatus ======================= +Version 0.15, released UNRELEASED +--------------------------------- + +* Bugfix: the String widget now handles non-string values. + Version 0.14, released 2011-08-31 --------------------------------- diff --git a/ttystatus/string.py b/ttystatus/string.py index 1dc3023..32a76ea 100644 --- a/ttystatus/string.py +++ b/ttystatus/string.py @@ -27,7 +27,7 @@ class String(ttystatus.Widget): self.value = '' def format(self): - return self.value + return str(self.value) def update(self, master, width): self.value = master[self._key] diff --git a/ttystatus/string_tests.py b/ttystatus/string_tests.py index b0e17dd..39f480a 100644 --- a/ttystatus/string_tests.py +++ b/ttystatus/string_tests.py @@ -30,3 +30,7 @@ class StringTests(unittest.TestCase): def test_updates(self): self.s.update({'foo': 'bar'}, 999) self.assertEqual(str(self.s), 'bar') + + def test_handles_non_string_value(self): + self.s.update({'foo': 123}, 999) + self.assertEqual(str(self.s), '123') |