From 3dd5fbda7e08999b6470cfe1fbbd19d767adea9b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 18 Nov 2021 11:59:53 +0300 Subject: Fix some linting errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Fix some obvious linting errors and remove obsolete code --- tests/unit/test_data_helpers.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/unit/test_data_helpers.py') diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py index 3f76344..88ea469 100644 --- a/tests/unit/test_data_helpers.py +++ b/tests/unit/test_data_helpers.py @@ -61,6 +61,21 @@ class TestDataHelpers(TestCase): expected) def test_partition_by(self): + """ + Test that `partition_by` groups the data using the given predicate + + Given: + - `part_fn`: a predicate funtion that return boolean True/False + - `items`: a sequence of items + When: + - the partitioning predicate function and the sequence of items are + passed to the `partition_by` function + Then: + - the result is a tuple, with sub-tuples containing the data in the + original sequence. Each sub-tuple is a partition, ending as soon as + the next value in the sequence, when passed to `part_fn`, returns + boolean `True`. + """ for part_fn, items, expected in ( (lambda s: s.startswith("----"), ("------", "a", "b", "-----", "c", "----", "d", "e", "---", -- cgit v1.2.3