changeset 20:8b9c6a6e7669

Added tests for utils.group_text.
author Brian Neal <bgneal@gmail.com>
date Sun, 09 Jun 2013 13:11:23 -0500
parents 467295d7807f
children eeda81e07800
files m209/tests/test_utils.py
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m209/tests/test_utils.py	Sun Jun 09 13:11:23 2013 -0500
@@ -0,0 +1,29 @@
+# Copyright (C) 2013 by Brian Neal.
+# This file is part of m209, the M-209 simulation.
+# m209 is released under the MIT License (see LICENSE.txt).
+
+"""Unit tests for the utils module."""
+
+import unittest
+
+from ..utils import group_text
+
+
+class UtilsTestCase(unittest.TestCase):
+
+    def test_group_text(self):
+        s = ''
+        r = group_text(s)
+        self.assertEqual(r, '')
+
+        s = 'ABCDE'
+        r = group_text(s)
+        self.assertEqual(r, 'ABCDE')
+
+        s = 'ABCDEFGH'
+        r = group_text(s)
+        self.assertEqual(r, 'ABCDE FGH')
+
+        s = 'ABCDEFGH'
+        r = group_text(s, 3)
+        self.assertEqual(r, 'ABC DEF GH')