diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-10 21:42:43 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-10 21:42:43 +0100 |
commit | 07c65509121c3badf1eaccd9072b7dbcab3fdacf (patch) | |
tree | 694f2665740fc31c73d0206d5c72c950919e1a63 | |
parent | 3e5f3ce0680ba2037d75f98f47dd9f422bd8bb37 (diff) | |
download | ttystatus-07c65509121c3badf1eaccd9072b7dbcab3fdacf.tar.gz |
Add: port to Python3
-rw-r--r-- | ttystatus/fmt_tests.py | 4 | ||||
-rw-r--r-- | ttystatus/status_tests.py | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/ttystatus/fmt_tests.py b/ttystatus/fmt_tests.py index 4582d00..8c01ae9 100644 --- a/ttystatus/fmt_tests.py +++ b/ttystatus/fmt_tests.py @@ -23,9 +23,9 @@ class FormatTests(unittest.TestCase): def test_knows_widgets(self): self.assertEqual(type(ttystatus.fmt.widgets), list) - self.assert_(len(ttystatus.fmt.widgets) > 0) + self.assertTrue(len(ttystatus.fmt.widgets) > 0) for widget in ttystatus.fmt.widgets: - self.assert_(issubclass(widget, ttystatus.Widget)) + self.assertTrue(issubclass(widget, ttystatus.Widget)) self.assertNotEqual(widget, ttystatus.Widget) def test_parses_string_without_widgets(self): diff --git a/ttystatus/status_tests.py b/ttystatus/status_tests.py index 92425ac..5b8cd09 100644 --- a/ttystatus/status_tests.py +++ b/ttystatus/status_tests.py @@ -14,12 +14,18 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -import StringIO +import io as StringIO import unittest import ttystatus +if 'unicode' in __builtins__: + make_text = __builtins__['unicode'] +else: + make_text = str + + class DummyMessager(object): def __init__(self): @@ -37,7 +43,7 @@ class DummyMessager(object): return True def write(self, string, force=False): - self.written.write(string) + self.written.write(make_text(string)) def notify(self, string, f, force=False): pass @@ -130,7 +136,7 @@ class TerminalStatusTests(unittest.TestCase): def test_enable_calls_messager_enable(self): self.ts.disable() self.ts.enable() - self.assert_(self.ts._m.enabled) + self.assertTrue(self.ts._m.enabled) def test_counts_correctly_even_without_rendering(self): w = ttystatus.Counter('value') |