def test_enable_type_casting_func(reload_power_module): pwr = [1, 2, 3] wap = [1, 2, 3] weight = 80 threshold_power = 80 assert isinstance(power.wpk(np.asarray(pwr), weight), np.ndarray) assert isinstance( power.relative_intensity(np.asarray(wap), threshold_power), np.ndarray) with pytest.raises(TypeError): power.wpk(pwr, weight) with pytest.raises(TypeError): power.relative_intensity(wap, threshold_power) doc_string = power.wpk.__doc__ wpk = utils.enable_type_casting(power.wpk) assert isinstance(wpk(pwr, weight), list) assert isinstance(wpk(pd.Series(pwr), weight), pd.Series) assert isinstance(wpk(np.asarray(pwr), weight), np.ndarray) with pytest.raises(TypeError): power.relative_intensity(wap, threshold_power) assert power.wpk.__doc__ == doc_string
def test_relative_intensity(): norm_power = 300.0 threshold_power = 300.0 assert relative_intensity(norm_power, threshold_power) == 1.0