:py:mod:`oioioi.problems.tests.utilities` ========================================= .. py:module:: oioioi.problems.tests.utilities Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.problems.tests.utilities.AssertContainsOnlyMixin oioioi.problems.tests.utilities.TestProblemController oioioi.problems.tests.utilities.DummyPackageBackend oioioi.problems.tests.utilities.DummySource oioioi.problems.tests.utilities.DummyContestController Functions ~~~~~~~~~ .. autoapisummary:: oioioi.problems.tests.utilities.dummy_handler oioioi.problems.tests.utilities.get_test_filename .. py:class:: AssertContainsOnlyMixin .. py:method:: assert_contains_only(response, allowed_values) .. py:class:: TestProblemController(problem) Bases: :py:obj:`oioioi.problems.controllers.ProblemController` Defines rules for handling specific problem. Every method should: * be called from contest controller * or be specific for problems that this controller controls Please note that a global problem instance exists for each problem. That problem instance has no contest (``contest`` is ``None``), so methods can't be overridden by a contest controller which means they behave in a default way. .. py:attribute:: __test__ :annotation: = False .. py:method:: fill_evaluation_environ(environ, submission, **kwargs) :abstractmethod: Fills a minimal environment with evaluation receipt and other values required by the evaluation machinery. Passed ``environ`` should already contain entries for the actiual data to be judged (for example the source file to evaluate). Details on which keys need to be present should be specified by particular subclasses. As the result, ``environ`` will be filled at least with a suitable evaluation ``recipe``. .. py:exception:: DummyPackageException Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:class:: DummyPackageBackend Bases: :py:obj:`oioioi.problems.package.ProblemPackageBackend` A class which manages problem packages. The main functionality is extracting archives with problem statements, data, model solutions etc. and building :class:`~oioioi.problems.models.Problem` instances. .. py:attribute:: description :annotation: = Dummy Package .. py:method:: identify(path, original_filename=None) Checks if the backend is suitable for processing the specified problem package. :param path: a path to the processed problem package :param original_filename: the name of the package specified by the uploading user. Returns ``True`` if the backend can handle the specified problem package file. .. py:method:: get_short_name(path, original_filename=None) Returns the problem's short name. :param path: a path to the processed problem package :param original_filename: the name of the package specified by the uploading user. .. py:method:: unpack(env) Processes a package, creating a new :class:`~oioioi.problems.models.Problem` or updating an existing one. This function will be called either from :func:`~oioioi.problems.unpackmgr.unpackmgr_job` (Celery task) or from :func:`~oioioi.problems.package.simple_unpack` (e.g. when a problem is added from a command line). Used ``env`` keys: ``package_id``: an id of the :class:`~oioioi.problems.models.ProblemPackage` instance with the package file to unpack. Produced ``env`` keys: ``problem_id``: an id of the :class:`~oioioi.problems.models.Problem` instance representing the created or modified problem. .. py:method:: pack(problem) Creates a package from problem, returns a :class:`django.http.HttpResponse` instance. Should raise ``NotImplementedError`` if creating packages is not supported. .. py:function:: dummy_handler(env) .. py:class:: DummySource Bases: :py:obj:`oioioi.problems.problem_sources.UploadedPackageSource` .. py:method:: create_env(*args, **kwargs) Creates an environment which will be later passed to :func:`~oioioi.problems.unpackmgr.unpackmgr_job`. .. py:class:: DummyContestController(contest) Bases: :py:obj:`oioioi.programs.controllers.ProgrammingContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:method:: adjust_upload_form(request, existing_problem, form) .. py:method:: fill_upload_environ(request, form, env) .. py:function:: get_test_filename(name)