def test_calculate_mil_217f_part_stress(category_id): """calculate() should return a dictionary of updated values on success when calculating 217F part stress.""" ATTRIBUTES['hazard_rate_method_id'] = 2 ATTRIBUTES['environment_active_id'] = 4 ATTRIBUTES['environment_dormant_id'] = 3 ATTRIBUTES['category_id'] = category_id if category_id == 10: for subcategory_id in [1, 2, 3, 4]: ATTRIBUTES['subcategory_id'] = subcategory_id _attributes, _msg = Component.calculate(**ATTRIBUTES) else: _attributes, _msg = Component.calculate(**ATTRIBUTES) assert isinstance(_attributes, dict) if category_id < 9: assert _msg == ''
def test_calculate_zero_mult_adj(): """calculate() should return an error message when the multiplicative adjustment factor is <= 0.0.""" ATTRIBUTES['hazard_rate_method_id'] = 1 ATTRIBUTES['environment_active_id'] = 4 ATTRIBUTES['environment_dormant_id'] = 3 ATTRIBUTES['category_id'] = 1 ATTRIBUTES['mult_adj_factor'] = 0.0 _attributes, _msg = Component.calculate(**ATTRIBUTES) assert isinstance(_attributes, dict) assert _msg == ("RAMSTK WARNING: Multiplicative adjustment factor is 0.0 " "when calculating hardware item, hardware ID: 6.\n")
def test_calculate_zero_quantity(): """calculate() should return an error message when the quantity is < 1.""" ATTRIBUTES['hazard_rate_method_id'] = 1 ATTRIBUTES['environment_active_id'] = 4 ATTRIBUTES['environment_dormant_id'] = 3 ATTRIBUTES['category_id'] = 1 ATTRIBUTES['mult_adj_factor'] = 1.0 ATTRIBUTES['duty_cycle'] = 1.0 ATTRIBUTES['quantity'] = 0 _attributes, _msg = Component.calculate(**ATTRIBUTES) assert isinstance(_attributes, dict) assert _msg == ("RAMSTK WARNING: Quantity is less than 1 when calculating " "hardware item, hardware ID: 6.\n")