oioioi.programs.tests

Module Contents

Classes

SubmitFileMixin

TestProgrammingProblemController

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestProgrammingContestController

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestProgramsViews

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestSourceWithoutContest

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestHeaderLinks

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestProgramsXssViews

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestOtherSubmissions

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestNoOtherSubmissions

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestDiffView

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestSubmission

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestSubmissionAdmin

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestSubmittingAsAdmin

Similar to TransactionTestCase, but use transaction.atomic() to achieve

PrivateProgrammingContestController

Contains the contest logic and rules.

TestSubmittingAsContestAdmin

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestSubmittingAsObserver

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestNotifications

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestScorers

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestUserOutsGenerating

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestAdminInOutDownload

Similar to TransactionTestCase, but use transaction.atomic() to achieve

ContestWithJudgeInfoController

Contains the contest logic and rules.

TestRejudge

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestLimitsLimits

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestCompiler

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestMaxScoreMigration

TestCase for Django Migrations

TestReportDisplayTypes

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestAllowedLanguages

Similar to TransactionTestCase, but use transaction.atomic() to achieve

TestLanguageOverrideForTest

Similar to TransactionTestCase, but use transaction.atomic() to achieve

Functions

extract_code(show_response)

extract_code_from_diff(show_response)

oioioi.programs.tests.extract_code(show_response)[source]
oioioi.programs.tests.extract_code_from_diff(show_response)[source]
class oioioi.programs.tests.SubmitFileMixin[source]

Bases: oioioi.contests.tests.SubmitMixin

submit_file(contest, problem_instance, file_size=1024, file_name='submission.cpp', kind='NORMAL', user=None)[source]
submit_code(contest, problem_instance, code='', prog_lang='C', send_file=False, kind='NORMAL', user=None)[source]
class oioioi.programs.tests.TestProgrammingProblemController(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance'][source]
test_safe_exec_mode()[source]
class oioioi.programs.tests.TestProgrammingContestController(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance'][source]
test_safe_exec_mode()[source]
class oioioi.programs.tests.TestProgramsViews(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase, oioioi.filetracker.tests.TestStreamingMixin

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions',...[source]
test_submission_views()[source]
test_test_views()[source]
test_submissions_permissions()[source]
test_model_solutions_view()[source]
class oioioi.programs.tests.TestSourceWithoutContest(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_problem_instance_without_contest', 'test_submission_source', 'test_full_package'][source]
test_source_permissions()[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission'][source]
class oioioi.programs.tests.TestProgramsXssViews(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase, oioioi.filetracker.tests.TestStreamingMixin

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission_xss'][source]
test_submission_xss_views()[source]
class oioioi.programs.tests.TestOtherSubmissions(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission',...[source]
_test_get(username)[source]
test_admin()[source]
test_user()[source]
class oioioi.programs.tests.TestNoOtherSubmissions(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission'][source]
_test_get(username)[source]
test_admin()[source]
test_user()[source]
class oioioi.programs.tests.TestDiffView(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission',...[source]
test_saving_button()[source]
test_diff_view()[source]
class oioioi.programs.tests.TestSubmission(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase, SubmitFileMixin

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission',...[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_submission_completed_notification()[source]
test_repeated_submission_fail()[source]
test_repeated_submission_different_problems()[source]
test_repeated_submission_success()[source]
test_simple_submission()[source]
test_huge_submission()[source]
test_huge_code_length()[source]
test_size_limit_accuracy()[source]
test_submissions_limitation()[source]
_assertUnsupportedExtension(contest, problem_instance, name, ext)[source]
test_extension_checking()[source]
test_code_pasting()[source]
test_pasting_unicode_code()[source]
test_limiting_extensions()[source]
class oioioi.programs.tests.TestSubmissionAdmin(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission'][source]
test_submissions_changelist()[source]
class oioioi.programs.tests.TestSubmittingAsAdmin(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_problem_instance', 'test_full_package'][source]
test_ignored_submission()[source]
test_submitting_as_self()[source]
class oioioi.programs.tests.PrivateProgrammingContestController(contest)[source]

Bases: oioioi.programs.controllers.ProgrammingContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

registration_controller()[source]
class oioioi.programs.tests.TestSubmittingAsContestAdmin(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions'][source]
test_missing_permission()[source]
class oioioi.programs.tests.TestSubmittingAsObserver(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions'][source]
test_ignored_submission()[source]
class oioioi.programs.tests.TestNotifications(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions',...[source]
test_initial_results_notification()[source]
class oioioi.programs.tests.TestScorers(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

t_results_ok = [None, None, None, None, None, None, None][source]
t_results_ok_perc = [None, None, None, None][source]
t_results_unequal_max_scores = [None, None][source]
t_expected_unequal_max_scores = [None, None][source]
t_results_wrong = [None, None][source]
t_expected_wrong = [None, None][source]
test_discrete_test_scorer()[source]
test_threshold_linear_test_scorer()[source]
g_results_ok()[source]
g_results_wrong()[source]
g_results_unequal_max_scores()[source]
test_min_group_scorer()[source]
test_sum_group_scorer()[source]
test_sum_score_aggregator()[source]
class oioioi.programs.tests.TestUserOutsGenerating(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission',...[source]
test_report_after_generate()[source]
test_generate_and_download_user_permission()[source]
class oioioi.programs.tests.TestAdminInOutDownload(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission'][source]
test_report_href_visibility()[source]
class oioioi.programs.tests.ContestWithJudgeInfoController(contest)[source]

Bases: oioioi.programs.controllers.ProgrammingContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

judged = False[source]
submission_judged(submission, rejudged=False)[source]
class oioioi.programs.tests.TestRejudge(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase, SubmitFileMixin

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission',...[source]
_set_active_tests(active_tests, all_tests)[source]
_test_rejudge(submit_active_tests, rejudge_active_tests, rejudge_type, tests_subset, expected_ok, expected_re)[source]
test_rejudge_full()[source]
test_rejudge_judged()[source]
test_rejudge_new()[source]
class oioioi.programs.tests.TestLimitsLimits(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_submission'][source]
form_data[source]
edit_settings()[source]
test_time_limit()[source]
test_memory_limit()[source]
class oioioi.programs.tests.TestCompiler(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions',...[source]
test_submit_view()[source]
test_compiler_hints_view()[source]
test_contest_admin_inline()[source]
test_contest_contest_admin_inline()[source]
test_problem_admin_inline()[source]
test_check_compiler_config_valid()[source]
test_check_compiler_config_invalid_compiler()[source]
test_check_compiler_config_no_compiler()[source]
class oioioi.programs.tests.TestMaxScoreMigration(methodName='runTest')[source]

Bases: oioioi.base.utils.test_migrations.TestCaseMigrations

TestCase for Django Migrations

migrate_from, migrate_to should be Django migration names of tested app setUpBeforeMigration(self, apps) method will be called before migrations are applied

source: https://www.caktusgroup.com/blog/2016/02/02/writing-unit-tests-django-migrations/

migrate_from = 0012_testreport_max_score[source]
migrate_to = 0014_remove_testreport_test_max_score[source]
make_report(problem_id, contest, apps, max_score)[source]
setUpBeforeMigration(apps)[source]
test()[source]
class oioioi.programs.tests.TestReportDisplayTypes(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['admin_admin', 'test_users', 'test_report_display_test'][source]
test_oi_display()[source]
test_acm_display()[source]
test_pa_display()[source]
class oioioi.programs.tests.TestAllowedLanguages(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase, SubmitFileMixin

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_users', 'test_contest', 'test_full_package', 'test_problem_instance', 'test_permissions',...[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_empty_whitelist()[source]
test_allowed_languages_dict()[source]
test_disallowed_language_submit_attempt()[source]
class oioioi.programs.tests.TestLanguageOverrideForTest(methodName='runTest')[source]

Bases: oioioi.base.tests.TestCase

Similar to TransactionTestCase, but use transaction.atomic() to achieve test isolation.

In most situations, TestCase should be preferred to TransactionTestCase as it allows faster execution. However, there are some situations where using TransactionTestCase might be necessary (e.g. testing some transactional behavior).

On database backends with no transaction support, TestCase behaves as TransactionTestCase.

fixtures = ['test_contest', 'test_full_package', 'test_problem_instance'][source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_proper_env_override()[source]