FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Cleared out my misunderstanding of the API docs · python-webuntis/python-webuntis@fbfb1df · GitHub

Repository navigation

Commit fbfb1df

Browse files
committed
Cleared out my misunderstanding of the API docs
type ==> code new type
1 parent 13e7729 commit fbfb1df

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

‎webuntis/objects.py‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,32 @@ def rooms(self):
367367
)
368368

369369
@lazyproperty
370-
def type(self):
370+
def code(self):
371371
'''May be:
372372
373373
- ``None`` -- There's nothing special about this period.
374374
- ``"cancelled"`` -- Cancelled
375375
- ``"irregular"`` -- Substitution/"Supplierung"/Not planned event
376376
'''
377377

378-
return (self._data['code'] if 'code' in self._data else None)
378+
if 'code' not in self._data:
379+
return None
380+
else:
381+
return self._data['code'] or None
382+
383+
@lazyproperty
384+
def type(self):
385+
'''
386+
May be:
387+
388+
- ``"ls"`` -- Normal lesson
389+
- ``"oh"`` -- Office hour
390+
- ``"sb"`` -- Standby
391+
- ``"bs"`` -- Break Supervision
392+
- ``"ex"`` -- Examination
393+
'''
394+
395+
return (self._data['lstype'] if 'lstype' in self._data else 'ls')
379396

380397

381398
class PeriodList(ListResult):

‎webuntis/tests/offline.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ def getRooms(self, url, jsondata, headers):
133133
period_raw['endTime']
134134
)
135135
if 'code' in period_raw:
136-
self.assertEqual(period_raw['code'], period.type)
136+
self.assertEqual(period_raw['code'], period.code)
137+
else:
138+
self.assertEqual(period.code, None)
139+
140+
if 'type' in period_raw:
141+
self.assertEqual(period_raw['lstype'], period.type)
142+
else:
143+
self.assertEqual(period.type, 'ls')
137144

138145
self.assertEqual(len(period_raw['kl']), len(period.klassen))
139146
for klasse_raw, klasse in zip(period_raw['kl'], period.klassen):

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL