I found that test_2_remove_add_words_and_exit() test from part06-16_dictionary_file prints wrong message.
The case was that my program used the following construction:
op = int(input("1 - Add word, 2 - Search, 3 - Quit\nFunction:")
so the test did not detect "1 - Add word, 2 - Search, 3 - Quit" as the part of the output (more likely you rely on print() function to be called), so only after converting the code to:
print("1 - Add word, 2 - Search, 3 - Quit") op = int(input("Function:"))
the test started working, but anyway in the error message of the test was wrong:
self.assertTrue(len(output.split("\n")) == 4, f"Program should output two lines with input\n{f(input_data)} now the output is \n{output}")
Here "two" should be changed to four.
Then if you grep for similar string you get one more place:
$ grep -r "lines with input" . grep: ./part06-11_diary/test/__pycache__/test_diary.cpython-310.pyc: binary file matches ./part06-11_diary/test/test_diary.py: self.assertFalse(len(output) == 0, f"Your program should output two lines with input\n{input_value}\nNow it outputs nothing\n{mssage}") ./part06-11_diary/test/test_diary.py: self.assertTrue(len(output.split("\n")) == 2, f"Your program should output two lines with input\n{input_value}\nNow it outputs \n{output}") grep: ./part06-16_dictionary_file/test/__pycache__/test_dictionary_file.cpython-310.pyc: binary file matches ./part06-16_dictionary_file/test/test_dictionary_file.py: self.assertTrue(len(output.split("\n")) == 2, f"Program should output two lines with input\n{f(input_data)} now the output is \n\"{output}\"") ./part06-16_dictionary_file/test/test_dictionary_file.py: self.assertTrue(len(output.split("\n")) == 4, f"Program should output two lines with input\n{f(input_data)} now the output is \n{output}")
I can't see I can fix this myself, so raising an issue
I found that test_2_remove_add_words_and_exit() test from part06-16_dictionary_file prints wrong message. The case was that my program used the following construction:
op = int(input("1 - Add word, 2 - Search, 3 - Quit\nFunction:")
so the test did not detect "1 - Add word, 2 - Search, 3 - Quit" as the part of the output (more likely you rely on print() function to be called), so only after converting the code to:print("1 - Add word, 2 - Search, 3 - Quit") op = int(input("Function:"))
the test started working, but anyway in the error message of the test was wrong:self.assertTrue(len(output.split("\n")) == 4, f"Program should output two lines with input\n{f(input_data)} now the output is \n{output}")
Here "two" should be changed to four. Then if you grep for similar string you get one more place:$ grep -r "lines with input" . grep: ./part06-11_diary/test/__pycache__/test_diary.cpython-310.pyc: binary file matches ./part06-11_diary/test/test_diary.py: self.assertFalse(len(output) == 0, f"Your program should output two lines with input\n{input_value}\nNow it outputs nothing\n{mssage}") ./part06-11_diary/test/test_diary.py: self.assertTrue(len(output.split("\n")) == 2, f"Your program should output two lines with input\n{input_value}\nNow it outputs \n{output}") grep: ./part06-16_dictionary_file/test/__pycache__/test_dictionary_file.cpython-310.pyc: binary file matches ./part06-16_dictionary_file/test/test_dictionary_file.py: self.assertTrue(len(output.split("\n")) == 2, f"Program should output two lines with input\n{f(input_data)} now the output is \n\"{output}\"") ./part06-16_dictionary_file/test/test_dictionary_file.py: self.assertTrue(len(output.split("\n")) == 4, f"Program should output two lines with input\n{f(input_data)} now the output is \n{output}")
I can't see I can fix this myself, so raising an issue