Skip to content

Commit

Permalink
Fix test_replays_to_json
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rook committed Jan 5, 2025
1 parent 9ab56f7 commit 00c4897
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions project/thscoreboard/replays/test_replays_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ def testConvertReplaysToJsonString(self):

def testMedalEmojisSingleShot(self):
for i in range(5):
user = self.createUser(f"user{i}")
with patch(
"replays.constant_helpers.CalculateReplayFileHash"
) as mocked_hash:
mocked_hash.return_value = bytes(i)
test_replays.CreateAsPublishedReplay(
"th10_normal",
user=self.user,
user=user,
score=1_000_000_000 - 100_000_000 * i,
difficulty=0,
)
Expand All @@ -111,11 +112,11 @@ def testMedalEmojisSingleShot(self):
converter = ReplayToJsonConverter()
json_data = [converter.convert_replay_to_dict(replay) for replay in replays]

self.assertEquals(json_data[0]["Score"]["text"], "πŸ₯‡1,000,000,000")
self.assertEquals(json_data[1]["Score"]["text"], "πŸ₯ˆ900,000,000")
self.assertEquals(json_data[2]["Score"]["text"], "πŸ₯‰800,000,000")
self.assertEquals(json_data[3]["Score"]["text"], "700,000,000")
self.assertEquals(json_data[4]["Score"]["text"], "600,000,000")
self.assertEqual(json_data[0]["Score"]["text"], "πŸ₯‡1,000,000,000")
self.assertEqual(json_data[1]["Score"]["text"], "πŸ₯ˆ900,000,000")
self.assertEqual(json_data[2]["Score"]["text"], "πŸ₯‰800,000,000")
self.assertEqual(json_data[3]["Score"]["text"], "700,000,000")
self.assertEqual(json_data[4]["Score"]["text"], "600,000,000")

def testMedalEmojisMultipleShots(self):
replay_filenames = [
Expand All @@ -136,5 +137,5 @@ def testMedalEmojisMultipleShots(self):
converter = ReplayToJsonConverter()
json_data = [converter.convert_replay_to_dict(replay) for replay in replays]

self.assertEquals(json_data[0]["Score"]["text"], "πŸ₯‡1,000,000,000")
self.assertEquals(json_data[1]["Score"]["text"], "πŸ₯‡900,000,000")
self.assertEqual(json_data[0]["Score"]["text"], "πŸ₯‡1,000,000,000")
self.assertEqual(json_data[1]["Score"]["text"], "πŸ₯‡900,000,000")

0 comments on commit 00c4897

Please sign in to comment.