Skip to content

Commit

Permalink
tests: refacto: comparaison par identité pour None
Browse files Browse the repository at this point in the history
  • Loading branch information
sblondon committed May 24, 2024
1 parent f48004d commit a3ec04e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion impact/api/tests/test_bges.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_aucune_annee_de_publication(mocker):

year = last_reporting_year(SIREN)

assert year == None
assert year is None
faked_request.assert_called_once_with(
"https://bilans-ges.ademe.fr/api/inventories",
params={"page": "1", "itemsPerPage": "11", "entity.siren": SIREN},
Expand Down
2 changes: 1 addition & 1 deletion impact/api/tests/test_egapro.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_succes_indicateurs_sans_objectif_de_progression(mocker):

bdese_indicateurs = indicateurs_bdese(SIREN, 2021)

assert bdese_indicateurs["objectifs_progression"] == None
assert bdese_indicateurs["objectifs_progression"] is None


def test_succes_indicateurs_avec_tous_les_objectifs_de_progression(mocker):
Expand Down
8 changes: 4 additions & 4 deletions impact/api/tests/test_recherche_entreprises.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def test_pas_de_nature_juridique(nature_juridique, mocker):
capture_message_mock.assert_called_once_with(
"Nature juridique récupérée par l'API recherche entreprises invalide"
)
assert infos["categorie_juridique_sirene"] == None
assert infos["categorie_juridique_sirene"] is None


def test_pas_de_code_pays_etranger(mocker):
Expand All @@ -259,7 +259,7 @@ def test_pas_de_code_pays_etranger(mocker):
capture_message_mock.assert_called_once_with(
"Code pays étranger récupéré par l'API recherche entreprises invalide"
)
assert infos["code_pays_etranger_sirene"] == None
assert infos["code_pays_etranger_sirene"] is None


def test_code_pays_etranger_vaut_null_car_en_France(mocker):
Expand All @@ -283,7 +283,7 @@ def test_code_pays_etranger_vaut_null_car_en_France(mocker):
infos = recherche(SIREN)

assert not capture_message_mock.called
assert infos["code_pays_etranger_sirene"] == None
assert infos["code_pays_etranger_sirene"] is None


@pytest.mark.parametrize("activite_principale", ["", None])
Expand All @@ -306,4 +306,4 @@ def test_pas_d_activite_principale(activite_principale, mocker):

infos = recherche(SIREN)

assert infos["code_NAF"] == None
assert infos["code_NAF"] is None
4 changes: 2 additions & 2 deletions impact/api/tests/test_sirene.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_pas_de_categorie_juridique(categorie_juridique, mocker):
capture_message_mock.assert_any_call(
"Catégorie juridique récupérée par l'API sirene invalide"
)
assert infos["categorie_juridique_sirene"] == None
assert infos["categorie_juridique_sirene"] is None


@pytest.mark.parametrize("activite_principale", ["", None])
Expand All @@ -241,7 +241,7 @@ def test_pas_d_activite_principale(activite_principale, mocker):
mocker.patch("requests.get", return_value=MockedResponse(200, json_content))
infos = recherche_unite_legale(SIREN)

assert infos["code_NAF"] == None
assert infos["code_NAF"] is None


def test_renouvelle_jeton_acces_insee(mocker, tmp_path, settings):
Expand Down
2 changes: 1 addition & 1 deletion impact/entreprises/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def test_convertit_code_pays():
assert convertit_code_pays(CODE_PAYS_CANADA) == "Canada"
assert convertit_code_pays(CODE_PAYS_PORTUGAL) == "Portugal"
assert convertit_code_pays(None) == "France"
assert convertit_code_pays(11111) == None # code inexistant actuellement
assert convertit_code_pays(11111) is None # code inexistant actuellement


def test_exercice_comptable_est_annee_civile():
Expand Down
2 changes: 1 addition & 1 deletion impact/reglementations/tests/test_bdese_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_category_field_with_category_type():
== category_field.category_type
== CategoryType.PROFESSIONNELLE
)
assert new_category_field.categories == category_field.categories == None
assert new_category_field.categories == category_field.categories is None


@pytest.mark.django_db(transaction=True)
Expand Down

0 comments on commit a3ec04e

Please sign in to comment.