The course 形势与政策 in 2022 Fall has a float value (.5) in zhxs field of course. The course data is provided at the end.
The field hour_week, which is corresponding to zhxs, has the type int in model Schedule. An error will occur when trying to load the course data to model.
A minimal reproduction:
import pysjtu
import json
with open('course.json') as f: # course.json is the json listed at the end
course = json.load(f)
s = pysjtu.models.Schedule(2022, 0)
s.load([course])
The traceback:
Traceback (most recent call last):
File "/home/truco/expr/py/main.py", line 11, in <module>
s.load([course])
File "/home/truco/.pyenv/versions/3.9.6/lib/python3.9/site-packages/pysjtu/models/base.py", line 192, in load
results = schema.load(data)
File "/home/truco/.pyenv/versions/3.9.6/lib/python3.9/site-packages/marshmallow/schema.py", line 722, in load
return self._do_load(
File "/home/truco/.pyenv/versions/3.9.6/lib/python3.9/site-packages/marshmallow/schema.py", line 909, in _do_load
raise exc
marshmallow.exceptions.ValidationError: {0: {'zhxs': ['Not a valid integer.']}}
The course 形势与政策 in 2022 Fall has a float value (
.5
) inzhxs
field of course. The course data is provided at the end.The field
hour_week
, which is corresponding tozhxs
, has the typeint
in modelSchedule
. An error will occur when trying to load the course data to model.A minimal reproduction:
The traceback:
The course data: