From ead5a5a1ad572ab6e55c29772df6616c9e377f28 Mon Sep 17 00:00:00 2001 From: JustusOmbok Date: Thu, 29 Aug 2024 15:39:51 +0300 Subject: [PATCH] Error correction for ColemanLiauIndex_test.py::test_call --- tests/tools/ColemanLiauIndex_test.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/tools/ColemanLiauIndex_test.py b/tests/tools/ColemanLiauIndex_test.py index 5c902edb1..9036e9833 100644 --- a/tests/tools/ColemanLiauIndex_test.py +++ b/tests/tools/ColemanLiauIndex_test.py @@ -18,4 +18,17 @@ def test_initialization(): @pytest.mark.unit def test_call(): tool = Tool() - assert tool(10, 10) == str(20) \ No newline at end of file + # Example input text for CLI calculation + input_data = {"input_text": "This is a simple test text. It contains two sentences."} + + # Calculating expected CLI score manually + num_sentences = 2 + num_words = 10 + num_characters = 42 + + L = (num_characters / num_words) * 100 + S = (num_sentences / num_words) * 100 + expected_cli_score = 0.0588 * L - 0.296 * S - 15.8 + + # Assert that the CLI tool calculates the expected value + assert tool(input_data) == pytest.approx(expected_cli_score, 0.01) \ No newline at end of file