def test_submission_from_url(self): submission = dispatch.submission_from_url( 'https://atcoder.jp/contests/agc039/submissions/7874055') self.assertIsInstance(submission, service.atcoder.AtCoderSubmission) self.assertIsInstance(submission.get_service(), service.atcoder.AtCoderService) problem = submission.download_problem() self.assertEqual(problem.contest_id, "agc039") self.assertEqual(problem.problem_id, "agc039_b")
def write_oj_result(self, msg: Union[str, bytes]): last_submission_url = None if isinstance(msg, bytes): msg = msg.decode() for line in msg.split("\n"): if line.startswith("[+]"): submit_result_prefix = "[+] success: result: " if line.startswith(submit_result_prefix): last_submission_url = line[len(submit_result_prefix) :] self.write(line, mode="success") elif line.startswith("[-]"): self.write(line, mode="error") else: self.write(line) if last_submission_url is not None: submission = submission_from_url(last_submission_url) if submission is not None: self.popup = CustomPopup(None, last_submission_url) self.popup.show()
def test_submission_from_url(self): self.assertIsNone( dispatch.submission_from_url('https://atcoder.jp/contests/agc039'))
def test_submission_from_url(self): submission = dispatch.submission_from_url('https://atcoder.jp/contests/agc039/submissions/7874055') self.assertIsInstance(submission, service.atcoder.AtCoderSubmission) self.assertIsInstance(submission.get_service(), service.atcoder.AtCoderService) self.assertEqual(submission.submission_id, 7874055)
def test_submission_eq(self): self.assertEqual(submission_from_url('https://atcoder.jp/contests/abc143/submissions/8264863'), submission_from_url('https://atcoder.jp/contests/abc143/submissions/8264863')) self.assertNotEqual(submission_from_url('https://atcoder.jp/contests/abc143/submissions/8264863'), submission_from_url('https://atcoder.jp/contests/abc143/submissions/8264897'))
def test_download_contest(self): submission = submission_from_url('https://atcoder.jp/contests/abc143/submissions/8059104') contest = submission.download_contest() self.assertIsInstance(contest, atcoder.AtCoderContest) self.assertEqual(contest.contest_id, 'abc143')