Skip to content

Clean yaml converter test files #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

killian-scalian
Copy link
Collaborator

  • add a separate test file for preprocessing

@killian-scalian killian-scalian marked this pull request as ready for review April 10, 2025 13:08
@killian-scalian killian-scalian requested a review from tbittar April 10, 2025 13:08
areas = converter.study.get_areas().values()
return areas, converter

def _generate_tdp_instance_parameter(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cette fonction est dupliquée dans test_converter, peut-on mutualiser ?

Copy link
Collaborator Author

@killian-scalian killian-scalian Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can, done in the last commit

"""
component = getattr(instance, process_method)()
expected_component = InputComponentParameter(
id=process_method.split("process_")[1],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je trouve ça très dangereux parce que si on renomme la méthode dans la classe ThermalDataPreProcessing sans renommer le paramètre du modèle, la fonction est cassée. Je préférerai que tu donnes aussi en argument de _validate_component l'id du paramètre directement

assert current_df.equals(expected_df)
assert component == expected_component

def _test_p_min_cluster(self, local_study_w_thermal: Study):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _test_p_min_cluster(self, local_study_w_thermal: Study):
def test_p_min_cluster(self, local_study_w_thermal: Study):

"""
areas, converter = self._init_area_reading(local_study_w_thermal)
study_path = converter.study_path
instance = generate_tdp_instance_parameter(areas, study_path)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peux-tu le renommer thermal_data_preprocessing dans tout le fichier pour plus de clarté ?

instance, expected_path = self._setup_test(
local_study_w_thermal, "nb_units_min"
)
instance.process_p_min_cluster()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile ça se fait dans _validate_component

instance, "process_nb_units_min", expected_path, expected_values
)

def test_nb_units_max(self, local_study_w_thermal: Study):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Les tests test_nb_units_max, test_nb_units_min, test_p_min_cluster sont très similaires, tu pourrais même utiliser parametrize

)
assert variation_component.value == str(expected_path)

def test_nb_units_max_variation_forward(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile grâce au parametrize

local_study_w_thermal, create_csv_from_constant_value, direction="forward"
)

def test_nb_units_max_variation_backward(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inutile grâce au parametrize

@killian-scalian killian-scalian deleted the contrib_factorization_tests_yaml_converter branch April 25, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants