summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-08-31 15:14:52 +0100
committerLars Wirzenius <liw@liw.fi>2011-08-31 15:14:52 +0100
commit62abfeeab9686248e54a04bac2f439cc77c78658 (patch)
tree22c393520022e0ff7b9f20fb08eb348a9964b457
parent31cb8821d1aa08bce246864554f18accd8873774 (diff)
downloadpython-ttystatus-62abfeeab9686248e54a04bac2f439cc77c78658.tar.gz
Start fmt module.
-rw-r--r--ttystatus/__init__.py2
-rw-r--r--ttystatus/fmt.py23
-rw-r--r--ttystatus/fmt_tests.py28
3 files changed, 53 insertions, 0 deletions
diff --git a/ttystatus/__init__.py b/ttystatus/__init__.py
index 794f0ee..c2cfebc 100644
--- a/ttystatus/__init__.py
+++ b/ttystatus/__init__.py
@@ -33,4 +33,6 @@ from remtime import RemainingTime
from elapsed import ElapsedTime
from bytespeed import ByteSpeed
+import fmt
+
__all__ = locals()
diff --git a/ttystatus/fmt.py b/ttystatus/fmt.py
new file mode 100644
index 0000000..16b2fe0
--- /dev/null
+++ b/ttystatus/fmt.py
@@ -0,0 +1,23 @@
+# Copyright 2011 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+import ttystatus
+
+
+widgets = [getattr(ttystatus, x)
+ for x in dir(ttystatus)
+ if isinstance(getattr(ttystatus, x), ttystatus.Widget) and
+ getattr(ttystatus, x) != ttystatus.Widget]
diff --git a/ttystatus/fmt_tests.py b/ttystatus/fmt_tests.py
new file mode 100644
index 0000000..76629c1
--- /dev/null
+++ b/ttystatus/fmt_tests.py
@@ -0,0 +1,28 @@
+# Copyright 2011 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+import unittest
+
+import ttystatus
+
+
+class FormatTests(unittest.TestCase):
+
+ def test_knows_widgets(self):
+ self.assertEqual(type(ttystatus.fmt.widgets), list)
+ for widget in ttystatus.fmt.widgets:
+ self.assert_(isinstance(widget, ttystatus.Widget))
+