def should_stores_requirements_for_characteristic(self):
        main = r.Characteristic()
        char = r.Characteristic()

        requirement = r.Requirement()
        requirement.characteristic = char
        requirement.from_resource = main
        requirement.pars = b.Pars()
        requirement.pars.dict = {'limits': [1, 2]}
        self.session.add(requirement)
        self.session.commit()

        assert main.requirements[0].characteristic == char
        assert main.requirements[0].pars['limits'] == [1, 2]
Beispiel #2
0
    def should_eval_ok_from_limits(self):
        characteristic = r.Characteristic()
        characteristic.key = 'char'
        part = i.Part()
        part.tracking = 'tr'

        measurement = i.Measurement(part, characteristic, 2.0)
        defect = measurement.evaluate([None, None], 1.0)
        assert defect is None

        # hi failure_mode
        defect = measurement.evaluate([-0.5, 0.5], 0.0)
        assert defect.failure_mode.key == 'hi-char'
        assert defect.tracking == 'tr*hi-char'
        assert part.defects[0] == defect

        # lw failure_mode
        defect = measurement.evaluate([2.1, 3.0], 0.0)
        assert defect.failure_mode.key == 'lw-char'
        assert defect.tracking == 'tr*lw-char'
        assert part.defects[1] == defect

        # shi failure_mode
        defect = measurement.evaluate([-2.5, 2.5], 0.6)
        assert defect.failure_mode.key == 'shi-char'
        assert defect.tracking == 'tr*shi-char'
        assert part.defects[2] == defect

        # lw failure_mode
        defect = measurement.evaluate([1.5, 3.0], 0.6)
        assert defect.failure_mode.key == 'slw-char'
        assert defect.tracking == 'tr*slw-char'
        assert part.defects[3] == defect
Beispiel #3
0
 def setup_method(self, method):
     super().setup_method(method)
     self.part = i.Part()
     self.part.tracking = '1234'
     self.part_model = r.PartModel()
     self.part_model.key = 'partnumber'
     self.part.part_model = self.part_model
     self.characteristic = r.Characteristic()
    def _should_stores_failure_modes_from_characteristic(self):
        char = r.Characteristic()

        failure = r.Failure(char, 'lw')
        self.session.add(failure)
        self.session.commit()

        assert char.failures[0] == failure
    def should_avoid_repeat_failure_modes(self):
        char = r.Characteristic()

        failure = r.Failure(char, 'lw')
        self.session.add(failure)
        self.session.commit()

        try:
            r.Failure(char, 'lw')
            pytest.fail('DuplicatedFailure exception should be raised')
        except r.DuplicatedFailure:
            pass
Beispiel #6
0
    def setup_method(self, method):
        super().setup_method(method)
        self.part = i.Part()

        self.characteristic = r.Characteristic()
Beispiel #7
0
    def setup_method(self, method):
        super().setup_method(method)
        self.part = i.Part()

        characteristic = r.Characteristic()
        self.failure_mode = r.FailureMode(characteristic, 'lw')