# HG changeset patch # User Brian Neal # Date 1370801483 18000 # Node ID 8b9c6a6e7669308b3e620193259686caf7335f19 # Parent 467295d7807f374c511321d01d4f0a1bfb78ccd4 Added tests for utils.group_text. diff -r 467295d7807f -r 8b9c6a6e7669 m209/tests/test_utils.py --- /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')