oioioi.rankings.tests

Module Contents

Classes

StatementHiderForContestController

Contains the contest logic and rules.

TestRankingViews

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

MockRankingController

Ranking system uses two types of keys: "partial key"s and "full key"s.

MockRankingContestController

Contains the contest logic and rules.

TestRecalc

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

TestRankingsdFrontend

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

TestResultColorClassFilter

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

Attributes

oioioi.rankings.tests.VISIBLE_TASKS = ['zad1', 'zad2'][source]
oioioi.rankings.tests.HIDDEN_TASKS = ['zad3', 'zad4'][source]
oioioi.rankings.tests.USER_CELL_PATTERN = <td[^>]*>%s</td>[source]
oioioi.rankings.tests.USER_CELL_PATTERN_LEFT = <td[^>]*>%s[source]
class oioioi.rankings.tests.StatementHiderForContestController(contest)[source]

Bases: oioioi.programs.controllers.ProgrammingContestController

Contains the contest logic and rules.

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

default_can_see_statement(request_or_context, problem_instance)[source]
class oioioi.rankings.tests.TestRankingViews(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_find_user()[source]
test_ranking_view()[source]
test_ranking_csv_view()[source]
test_invalidate_view()[source]
class oioioi.rankings.tests.MockRankingController(contest)[source]

Bases: oioioi.rankings.controllers.DefaultRankingController

Ranking system uses two types of keys: “partial key”s and “full key”s. Please note that full keys are abbreviated in the code as “key”s.

A pair (request, partial_key) should allow to build a full key, while a partial_key can always be extracted from the full key. partial keys identify the rounds to display and are used everywhere outside controllers and rankingsd (e.g. in views and urls). However, the actual ranking contents can depend on many other factors, like user permissions. This was the reason for introduction of full keys, which are always sufficient to choose the right data for serialization and display.

recalculation_result = ['serialized', ['1st', '2nd', '3rd']][source]
build_ranking(key)[source]

Serializes data and renders html for given key.

Results are processed using serialize_ranking, and then as many pages as needed are rendered. Returns a tuple containing serialized data and a list of strings, that are html code of ranking pages.

class oioioi.rankings.tests.MockRankingContestController(contest)[source]

Bases: oioioi.programs.controllers.ProgrammingContestController

Contains the contest logic and rules.

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

ranking_controller()[source]
class oioioi.rankings.tests.TestRecalc(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_empty()[source]
test_simple_flow()[source]
test_simple_invalidate()[source]
test_invalidate_preferences_saved()[source]
test_null_checking()[source]
class oioioi.rankings.tests.TestRankingsdFrontend(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_first_ranking_view()[source]
test_display_ranking()[source]
test_display_outdated()[source]
class oioioi.rankings.tests.TestResultColorClassFilter(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.

test_integer_scores()[source]
test_pa_scores()[source]
_test_scores(score_multiply, score_class_factory)[source]
static pa_score_factory(int_score)[source]
test_empty_scores()[source]
check_score_color(int_score, color_class_name, score_class_factory)[source]