summaryrefslogtreecommitdiff
path: root/morphlib/util_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/util_tests.py')
-rw-r--r--morphlib/util_tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py
index 2ad9e8aa..fbf7f27b 100644
--- a/morphlib/util_tests.py
+++ b/morphlib/util_tests.py
@@ -110,3 +110,14 @@ class ParseEnvironmentPairsTests(unittest.TestCase):
d = { 'a': 1 }
morphlib.util.sanitize_environment(d)
self.assertTrue(isinstance(d['a'], str))
+
+class IterTrickleTests(unittest.TestCase):
+
+ def test_splits(self):
+ self.assertEqual(list(morphlib.util.iter_trickle("foobarbazqux", 3)),
+ [["f", "o", "o"], ["b", "a", "r"],
+ ["b", "a", "z"], ["q", "u", "x"]])
+
+ def test_truncated_final_sequence(self):
+ self.assertEqual(list(morphlib.util.iter_trickle("barquux", 3)),
+ [["b", "a", "r"], ["q", "u", "u"], ["x"]])