Esempio n. 1
0
class SymbolicProblemTypeBase(ProblemTypeTestBase):
    """
    ProblemTypeTestBase specialization  for Symbolic Problem Type
    """
    problem_name = 'SYMBOLIC TEST PROBLEM'
    problem_type = 'symbolicresponse'
    partially_correct = False

    factory = SymbolicResponseXMLFactory()

    factory_kwargs = {
        'expect': '2*x+3*y',
        'question_text': 'Enter a value'
    }

    status_indicators = {
        'correct': ['div.capa_inputtype div.correct'],
        'incorrect': ['div.capa_inputtype div.incorrect'],
        'unanswered': ['div.capa_inputtype div.unanswered'],
        'submitted': ['div.capa_inputtype div.submitted'],
    }

    def answer_problem(self, correctness):
        """
        Answer symbolic problem.
        """
        choice = "2*x+3*y" if correctness == 'correct' else "3*a+4*b"
        self.problem_page.fill_answer(choice)
Esempio n. 2
0
class SymbolicProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
    """
    TestCase Class for Symbolic Problem Type
    """
    problem_name = 'SYMBOLIC TEST PROBLEM'
    problem_type = 'symbolicresponse'

    factory = SymbolicResponseXMLFactory()

    factory_kwargs = {
        'expect': '2*x+3*y',
    }

    status_indicators = {
        'correct': ['span div.correct'],
        'incorrect': ['span div.incorrect'],
        'unanswered': ['span div.unanswered'],
    }

    def setUp(self, *args, **kwargs):
        """
        Additional setup for SymbolicProblemTypeTest
        """
        super(SymbolicProblemTypeTest, self).setUp(*args, **kwargs)
        self.problem_page.a11y_audit.config.set_rules({
            'ignore': [
                'section',  # TODO: wcag2aa
                'label',  # TODO: AC-294
            ]
        })

    def answer_problem(self, correct):
        """
        Answer symbolic problem.
        """
        choice = "2*x+3*y" if correct else "3*a+4*b"
        self.problem_page.fill_answer(choice)