Example #1
0
    def test_step(self):
        title = 'Calculated some random impact'
        description = 'Calculated some random impact'
        provenance_step = ProvenanceStep(title, description)

        # check that we get the correct step message
        self.assertIs(provenance_step.title, title)

        # check that the timestamp is correct
        delta_seconds = (datetime.now() - provenance_step.time).total_seconds()
        self.assertLessEqual(delta_seconds, 0.1)
Example #2
0
    def append_step(self, title, description, timestamp=None):
        """
        Append a new provenance step.

        :param title: the title of the ProvenanceStep
        :type title: str
        :param description: the description of the ProvenanceStep
        :type description: str
        :param timestamp: the time of the ProvenanceStep
        :type timestamp: datetime
        :return: the time of the ProvenanceStep
        :rtype: datetime
        """
        step = ProvenanceStep(title, description, timestamp)
        self._steps.append(step)
        return step.time