def test_scale_note(self): note = note_copy.Note(1, 2, 30, 40, 'test') source_dimensions = (100, 200) destination_dimensions = (300, 400) result = note_copy.scale_note(note, source_dimensions, destination_dimensions) expected_result = note_copy.Note(3, 4, 90, 80, 'test') self.assertEqual(expected_result, result)
def test_notes_property(self, mock_auth): mock_auth.return_value = GELBOORU_TEST_AUTH expected_result = [ note_copy.Note(223, 17, 217, 55, 'Hirasawa U&I'), note_copy.Note(187, 879, 40, 95, 'Tights'), ] result = self.post.notes self.assertEqual(expected_result, result)
def test_int_params(self): result = note_copy.Note(1, 2, 3, 4, 'test') self.assertEqual(1, result.x) self.assertEqual(2, result.y) self.assertEqual(3, result.width) self.assertEqual(4, result.height) self.assertEqual('test', result.body)
def test_equality_does_match(self): danbooru_post_1 = note_copy.DanbooruPost(1234) # Simulate note being fetched danbooru_post_1.notes = [note_copy.Note(1, 2, 3, 4, 'test')] danbooru_post_2 = note_copy.DanbooruPost('1234') self.assertEqual(danbooru_post_1, danbooru_post_2)
def test_repr(self): note = note_copy.Note(1, 2, 3, 4, '"I swear I don\'t even"') self.assertEqual(note, eval(repr(note)))
def test_str_with_long_body_below_limit(self): expected_result = '3x4 1,2 abcdefghijklmnopqrstuvwxyz123' result = str( note_copy.Note(1, 2, 3, 4, 'abcdefghijklmnopqrstuvwxyz123')) self.assertEqual(expected_result, result)
def test_str_with_long_body(self): expected_result = '3x4 1,2 abcdefghijklmnopqrstuvwxyz1...' result = str( note_copy.Note(1, 2, 3, 4, 'abcdefghijklmnopqrstuvwxyz1234567890')) self.assertEqual(expected_result, result)
def test_str(self): expected_result = '3x4 1,2 test' result = str(note_copy.Note(1, 2, 3, 4, 'test')) self.assertEqual(expected_result, result)
def test_str_params(self): expected_result = note_copy.Note(1, 2, 3, 4, 'test') result = note_copy.Note('1', '2', '3', '4', 'test') self.assertEqual(expected_result, result)