diff --git a/cat_win/tests/src/domain/test_arguments.py b/cat_win/tests/src/domain/test_arguments.py index 6d9972a..76e3050 100644 --- a/cat_win/tests/src/domain/test_arguments.py +++ b/cat_win/tests/src/domain/test_arguments.py @@ -38,6 +38,32 @@ def test_delete_args(self): self.assertListEqual(u_args.args, []) self.assertEqual(len(u_args.args_id), 0) + def test_find_first(self): + u_args = Arguments() + u_args.set_args([(ARGS_NUMBER, 'a'), (ARGS_LLENGTH, 'b')]) + self.assertTupleEqual(u_args.find_first(ARGS_NUMBER, ARGS_LLENGTH, False), (ARGS_NUMBER, 'a')) + u_args = Arguments() + u_args.set_args([(ARGS_NUMBER, 'a'), (ARGS_LLENGTH, 'b')]) + self.assertTupleEqual(u_args.find_first(ARGS_LLENGTH, ARGS_NUMBER, False), (ARGS_NUMBER, 'a')) + u_args = Arguments() + u_args.set_args([(ARGS_NUMBER, 'a'), (ARGS_ENDS, 'c')]) + self.assertTupleEqual(u_args.find_first(ARGS_NUMBER, ARGS_LLENGTH, False), (ARGS_NUMBER, 'a')) + u_args = Arguments() + u_args.set_args([(ARGS_ENDS, 'c'), (ARGS_LLENGTH, 'b')]) + self.assertTupleEqual(u_args.find_first(ARGS_LLENGTH, ARGS_NUMBER, False), (ARGS_LLENGTH, 'b')) + u_args = Arguments() + u_args.set_args([(ARGS_ENDS, 'c')]) + self.assertEqual(u_args.find_first(ARGS_LLENGTH, ARGS_NUMBER, False), None) + u_args = Arguments() + u_args.set_args([(ARGS_NUMBER, 'a'), (ARGS_LLENGTH, 'b')]) + self.assertTupleEqual(u_args.find_first(ARGS_NUMBER, ARGS_LLENGTH, True), (ARGS_NUMBER, 'a')) + u_args = Arguments() + u_args.set_args([(ARGS_NUMBER, 'a'), (ARGS_LLENGTH, 'b')]) + self.assertEqual(u_args.find_first(ARGS_LLENGTH, ARGS_NUMBER, True), None) + u_args = Arguments() + u_args.set_args([(ARGS_ENDS, 'c')]) + self.assertEqual(u_args.find_first(ARGS_LLENGTH, ARGS_NUMBER, True), None) + def test_reduce_list(self): test_list = [(ARGS_NUMBER, 'a'), (ARGS_LLENGTH, 'b')] reduced_list = reduce_list(test_list) diff --git a/cat_win/tests/src/domain/test_file.py b/cat_win/tests/src/domain/test_file.py index 5af9384..e539274 100644 --- a/cat_win/tests/src/domain/test_file.py +++ b/cat_win/tests/src/domain/test_file.py @@ -32,3 +32,8 @@ def test_file_plaintext(self): file.set_plaintext(False) self.assertEqual(file.plaintext, False) + + def test_file_hashable(self): + file = File('testPath', 'testName') + file2 = File('testPath', 'testName') + self.assertSetEqual({file, file2}, {file2}) diff --git a/cat_win/tests/src/service/test_editor.py b/cat_win/tests/src/service/test_editor.py index 3264036..56c3638 100644 --- a/cat_win/tests/src/service/test_editor.py +++ b/cat_win/tests/src/service/test_editor.py @@ -959,7 +959,7 @@ def test_editor_interrupt(self): with self.assertRaises(KeyboardInterrupt): with patch('sys.stderr', new=StdOutMock()) as fake_out: editor._action_interrupt() - self.assertEqual('Interrupting...\n', fake_out.getvalue()) + self.assertEqual('Interrupting...\n', fake_out.getvalue()) def test__action_resize(self): editor = Editor('', '')