Skip to content

Commit

Permalink
added edge case tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Dec 13, 2024
1 parent 5969384 commit db562dd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
26 changes: 26 additions & 0 deletions cat_win/tests/src/domain/test_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions cat_win/tests/src/domain/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
2 changes: 1 addition & 1 deletion cat_win/tests/src/service/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('', '')
Expand Down

0 comments on commit db562dd

Please sign in to comment.