def test_power_factor(): c = copy.deepcopy(cables["passes"]) results = [] for i in itertools.product( range(100, 1001, 150), # conductor size np.arange(0.01, 0.91, 0.1), # ac_resistance np.arange(0, 1, 0.15), # inductance range(100, 1001, 150), # capacitance ): c["conductor_size"] = i[0] c["ac_resistance"] = i[1] c["inductance"] = i[2] c["capacitance"] = i[3] cable = Cable(c) results.append(cable.power_factor) if any((a < 0) | (a > 1) for a in results): raise Exception("Invalid Power Factor.")
def test_cable_required_inputs(): with pytest.raises(ValueError): Cable(cables["empty"])
def test_cable_creation(): cable = Cable(cables["passes"]) assert cable for r in cable.required: assert getattr(cable, r, None) == cables["passes"][r]