def parse_recording(self, recording, test_case_sample):
        """

        :type recording: list[apiritif.Event]
        :type test_case_sample: Sample
        :rtype: list[Sample]
        """
        self.active_transactions.append(test_case_sample)
        for item in recording:
            if isinstance(item, apiritif.Request):
                self._parse_request(item)
            elif isinstance(item, apiritif.TransactionStarted):
                self._parse_transaction_started(item)
            elif isinstance(item, apiritif.TransactionEnded):
                self._parse_transaction_ended(item)
            elif isinstance(item, apiritif.Assertion):
                self._parse_assertion(item)
            elif isinstance(item, apiritif.AssertionFailure):
                self._parse_assertion_failure(item)
            else:
                raise ValueError("Unknown kind of event in apiritif recording: %s" % item)

        if len(self.active_transactions) != 1:
            # TODO: shouldn't we auto-balance them?
            raise ValueError("Can't parse apiritif recordings: unbalanced transactions")

        toplevel_sample = self.active_transactions.pop()

        return [toplevel_sample]
def parse_recording ( self , recording , test_case_sample ) : self . active_transactions . append ( test_case_sample ) for item in recording : if isinstance ( item , apiritif . Request ) : self . _parse_request ( item ) elif isinstance ( item , apiritif . TransactionStarted ) : self . _parse_transaction_started ( item ) elif isinstance ( item , apiritif . TransactionEnded ) : self . _parse_transaction_ended ( item ) elif isinstance ( item , apiritif . Assertion ) : self . _parse_assertion ( item ) elif isinstance ( item , apiritif . AssertionFailure ) : self . _parse_assertion_failure ( item ) else : raise ValueError ( "Unknown kind of event in apiritif recording: %s" % item ) if len ( self . active_transactions ) != 1 : raise ValueError ( "Can't parse apiritif recordings: unbalanced transactions" ) toplevel_sample = self . active_transactions . pop ( ) return [ toplevel_sample ]
:type recording: list[apiritif.Event]
        :type test_case_sample: Sample
        :rtype: list[Sample]