Beispiel #1
0
    def test_update_scheme_force(self):
        my_scheme = Scheme(commands=[Jump])
        question = Question("What?", scheme=my_scheme)

        self.assertEqual([my_scheme], question.mounted_schemes)

        question.update_scheme(my_scheme, force=True)

        self.assertEqual([my_scheme, my_scheme], question.mounted_schemes)
        self.assertEqual([Jump, Jump], question.commands)
Beispiel #2
0
    def test_question_prompt_changes_with_quiz(self):
        question = Question("What?")
        question2 = Question("Hello?")
        Quiz(questions=[question, question2])

        self.assertEqual(
            "* Question 1/2. [No answer]\nWhat?", question.get_prompt()
        )

        question.update_scheme(Scheme(suffix="Suf", prefix="Pre"))
        self.assertEqual(
            "* Question 1/2. [No answer]\nPreWhat?Suf", question.get_prompt()
        )
Beispiel #3
0
    def test_scheme_allows_external_interference(self):
        my_scheme = Scheme(prompt="Hello")
        question = Question("What?")

        question.update_scheme(my_scheme)
        self.assertEqual("Hello", question.prompt)