@@ -470,7 +470,7 @@ def _parse_response(self, response: _Element) -> tuple[str, list[_Element], Any
470470 error .assert_ (status )
471471 self .validate_status (status )
472472 elif elem .tag == dav .Href .tag :
473- assert not href
473+ error . assert_ ( not href )
474474 href = _normalize_href (elem .text or "" )
475475 elif elem .tag == dav .PropStat .tag :
476476 propstats .append (elem )
@@ -507,8 +507,6 @@ def _parse_scheduling_response_objects(self, parent) -> dict:
507507 attendee - potentially with error status for all or some
508508 of the wanted attendees.
509509
510- TODO: some asserts here - should make better error handling
511-
512510 Returns:
513511 Dict with:
514512 * email addresses -> FreeBusy status (raw data)
@@ -517,9 +515,9 @@ def _parse_scheduling_response_objects(self, parent) -> dict:
517515 """
518516 self .objects = {}
519517 self .objects ["errors" ] = {}
520- assert self .tree .tag == cdav .ScheduleResponse .tag
518+ error . assert_ ( self .tree .tag == cdav .ScheduleResponse .tag )
521519 for response in self .tree :
522- assert response .tag == cdav .Response .tag
520+ error . assert_ ( response .tag == cdav .Response .tag )
523521 parsed_response = self ._parse_scheduling_response (response )
524522 for x in parsed_response :
525523 if x .endswith (":err" ):
@@ -531,8 +529,6 @@ def _parse_scheduling_response_objects(self, parent) -> dict:
531529
532530 def _parse_scheduling_response (self , response ) -> dict [str , str ]:
533531 """
534- TODO: lots of asserts here - should make better error handling
535-
536532 Parses one attendee response from a RFC6638 freebusy scheduling request
537533
538534 Returns:
@@ -547,7 +543,7 @@ def _parse_scheduling_response(self, response) -> dict[str, str]:
547543 for x in response :
548544 if x .tag == cdav .Recipient .tag :
549545 if len (x ) == 1 :
550- assert x [0 ].tag == dav .Href .tag
546+ error . assert_ ( x [0 ].tag == dav .Href .tag )
551547 recipient = x [0 ].text
552548 else :
553549 recipient = x .text
@@ -557,8 +553,8 @@ def _parse_scheduling_response(self, response) -> dict[str, str]:
557553 calendar_data = x .text
558554 else :
559555 raise error .DAVError (f"unexpected attribute { x .tag } " )
560- assert recipient
561- assert status
556+ error . assert_ ( recipient )
557+ error . assert_ ( status )
562558 if not status .startswith ("2.0" ):
563559 ret [f"{ recipient } :err" ] = status
564560 if calendar_data :
0 commit comments