mirror of https://github.com/dirtbags/moth.git
Force answers to be provided as strings
This commit is contained in:
parent
4aad492396
commit
214b37dfdb
|
@ -143,10 +143,13 @@ class Puzzle:
|
||||||
elif key == 'summary':
|
elif key == 'summary':
|
||||||
self.summary = val
|
self.summary = val
|
||||||
elif key == 'answer':
|
elif key == 'answer':
|
||||||
|
if not isinstance(val, str):
|
||||||
|
raise ValueError("Answers must be strings, got %s, instead" % (type(val),))
|
||||||
self.answers.append(val)
|
self.answers.append(val)
|
||||||
elif key == "answers":
|
elif key == "answers":
|
||||||
for answer in val:
|
for answer in val:
|
||||||
answer = str(answer)
|
if not isinstance(answer, str):
|
||||||
|
raise ValueError("Answers must be strings, got %s, instead" % (type(answer),))
|
||||||
self.answers.append(answer)
|
self.answers.append(answer)
|
||||||
elif key == 'pattern':
|
elif key == 'pattern':
|
||||||
self.pattern = val
|
self.pattern = val
|
||||||
|
|
Loading…
Reference in New Issue