From 3f0916029b3bef8019b1420cc06c57eb7557009d Mon Sep 17 00:00:00 2001 From: Jack Grahl <jack.grahl@gmail.com> Date: Fri, 20 Jan 2023 14:24:30 +0000 Subject: [PATCH] Add two tests which provide explicit nouns. These tests are the same as test_row_change_and_row_add_and_row_deleted and test_rows_added, except that they provide override for the noun used in the human readable output. --- tests/test_human_text.py | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/tests/test_human_text.py b/tests/test_human_text.py index f1bd381..3de2326 100644 --- a/tests/test_human_text.py +++ b/tests/test_human_text.py @@ -137,6 +137,65 @@ def test_row_changed_and_row_added_and_row_deleted(): ) +def test_with_item_nouns(): + "Should have headers for each section here" + diff = compare( + load_csv(io.StringIO(ONE), key="id"), load_csv(io.StringIO(SIX), key="id") + ) + assert ( + dedent( + """ + 1 thing changed, 1 thing added, 1 thing removed + + 1 thing changed + + id: 1 + age: "4" => "5" + + 1 thing added + + id: 3 + name: Bailey + age: 1 + + 1 thing removed + + id: 2 + name: Pancakes + age: 2 + """ + ).strip() + == human_text(diff, "id", "thing", "things") + ) + + +def test_with_plural_nouns(): + diff = compare( + load_csv(io.StringIO(THREE), key="id"), load_csv(io.StringIO(FIVE), key="id") + ) + assert ( + dedent( + """ + 3 entities added + + id: 2 + name: Pancakes + age: 2 + + id: 3 + name: Bailey + age: 1 + + id: 4 + name: Carl + age: 7 + """ + ).strip() + == human_text(diff, "id", "entity", "entities") + ) + + + def test_columns_changed(): diff = compare( load_csv(io.StringIO(SIX), key="id"), load_csv(io.StringIO(SEVEN), key="id")