def test_process_key_iv_points_no_inputs(self): self._make_mocked_api() module = Module(api=self.mocked_api) with self.assertRaises(ValueError) as e: module.process_key_iv_points() self.assertEqual( e.exception.args[0], "Either a file path to the .xslx template for Key IV Points input or the " "properly formatted JSON-serializable data structure for Key IV Points " "input must be assigned as input. See the Python SDK documentation " "(https://plantpredict-python.readthedocs.io/en/latest/) for more " "information.")
def test_process_key_iv_points_conflicting_inputs(self): self._make_mocked_api() module = Module(api=self.mocked_api) with self.assertRaises(ValueError) as e: module.process_key_iv_points(file_path="fake_file_path.xlsx", key_iv_points_data={ "temperature": 25, "irradiance": 1000, "short_circuit_current": 9.43, "open_circuit_voltage": 46.39, "mpp_current": 8.9598, "mpp_voltage": 38.1285, "max_power": 341.6237 }) self.assertEqual(e.exception.args[0], "Only one input option may be specified.")
def test_process_key_iv_points_with_data(self): self._make_mocked_api() module = Module(api=self.mocked_api) response = module.process_key_iv_points( key_iv_points_data=[{ "temperature": 25, "irradiance": 1000, "short_circuit_current": 9.43, "open_circuit_voltage": 46.39, "mpp_current": 8.9598, "mpp_voltage": 38.1285, "max_power": 341.6237 }, { "temperature": 25, "irradiance": 1000, "short_circuit_current": 9.43, "open_circuit_voltage": 46.39, "mpp_current": 8.9598, "mpp_voltage": 38.1285, "max_power": 341.6237 }]) self.assertEqual( json.loads(response.content), { "stc_short_circuit_current": 1.7592, "stc_open_circuit_voltage": 90.2189, "stc_mpp_current": 1.6084, "stc_mpp_voltage": 72.4938, "stc_short_circuit_current_temp_coef": 0.0519, "stc_open_circuit_voltage_temp_coef": -0.3081, "stc_power_temp_coef": -0.3535, "effective_irradiance_response": [ { "temperature": 25, "irradiance": 1000, "relative_efficiency": 1.0 }, { "temperature": 25, "irradiance": 800, "relative_efficiency": 1.0039 }, { "temperature": 25, "irradiance": 600, "relative_efficiency": 1.0032 }, { "temperature": 25, "irradiance": 400, "relative_efficiency": 0.9925 }, { "temperature": 25, "irradiance": 200, "relative_efficiency": 0.9582 }, ] }) self.assertEqual(module.stc_short_circuit_current, 1.7592) self.assertEqual(module.effective_irradiance_response, [ { "temperature": 25, "irradiance": 1000, "relative_efficiency": 1.0 }, { "temperature": 25, "irradiance": 800, "relative_efficiency": 1.0039 }, { "temperature": 25, "irradiance": 600, "relative_efficiency": 1.0032 }, { "temperature": 25, "irradiance": 400, "relative_efficiency": 0.9925 }, { "temperature": 25, "irradiance": 200, "relative_efficiency": 0.9582 }, ])