Newer
Older
from __future__ import annotations
__copyright__ = "Copyright (C) 2018 Dong Zhuang"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
from course.content import get_repo_blob
from course.flow import get_page_behavior
from tests.base_test_mixins import SingleCourseQuizPageTestMixin
from tests.test_sandbox import SingleCoursePageSandboxTestBaseMixin
INLINE_MULTI_MARKDOWN_SINGLE = """
type: InlineMultiQuestion
id: inlinemulti
value: 10
prompt: |
# An InlineMultiQuestion example
Complete the following paragraph.
question: |
Foo and [[blank1]] are often used in code examples.
answers:
blank1:
type: ShortAnswer
width: 4em
required: False
hint: Tex can be rendered in hint, e.g. $x_1$.
hint_title: Hint
correct_answer:
- <plain> BAR
- <plain>bar
"""
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
type: InlineMultiQuestion
id: inlinemulti
value: 10
prompt: |
# An InlineMultiQuestion example
Complete the following paragraph.
question: |
Foo and [[blank1]] are often used in code examples.
A quarter equals [[choice1]].
answers:
blank1:
type: ShortAnswer
width: 4em
required: False
hint: Tex can be rendered in hint, e.g. $x_1$.
hint_title: Hint
correct_answer:
- <regex>(?:bar)?\s+
- <plain> BAR
- <plain>bar
choice1:
type: ChoicesAnswer
choices:
- 0.2
- 1/6
- ~CORRECT~ 0.25
- <div><p>This_should_be_wrapped_by_p_tag</p></div>
- [0.25]
"""
INLINE_MULTI_MARKDOWN_EMBEDDED_ATTR_PATTERN = """
type: InlineMultiQuestion
id: inlinemulti
value: 10
prompt: |
# An InlineMultiQuestion example
Complete the following paragraph.
question: |
Foo and [[blank1]] are often used in code examples.
One dollar is [[blank2]].
answers:
blank1:
type: ShortAnswer
%(attr1)s
correct_answer:
- <plain> BAR
- <plain>bar
blank2:
type: ShortAnswer
%(attr2)s
correct_answer:
- type: float
rtol: 0.00001
value: 1
- <plain> one
"""
INLINE_MULTI_MARKDOWN_FLOAT_WITHOUT_TOL = """
type: InlineMultiQuestion
id: inlinemulti
value: 10
prompt: |
# An InlineMultiQuestion example
Complete the following paragraph.
question: |
Foo and [[blank1]] are often used in code examples.
One dollar is [[blank2]].
answers:
blank1:
type: ShortAnswer
width: 4em
required: False
hint: Tex can be rendered in hint, e.g. $x_1$.
hint_title: Hint
correct_answer:
- <plain> BAR
- <plain>bar
blank2:
type: ShortAnswer
width: 3em
prepended_text: "$"
hint: Blank with prepended text
correct_answer:
- type: float
value: 1
"""
INLINE_MULTI_MARKDOWN_NOT_ALLOWED_EMBEDDED_QTYPE = """
type: InlineMultiQuestion
id: inlinemulti
value: 10
prompt: |
# An InlineMultiQuestion example
Complete the following paragraph.
question: |
Foo and [[blank1]] are often used in code examples.
answers:
blank1:
type: SomeQuestionType
width: 4em
required: False
hint: Tex can be rendered in hint, e.g. $x_1$.
hint_title: Hint
correct_answer:
- <plain> BAR
- <plain>bar
"""
Loading
Loading full blame...