From bbd8ce7fbe488d0e471dfd1d943491cc82d4c7eb Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Tue, 31 Oct 2023 08:16:23 +0100
Subject: [PATCH 1/4] DataModel: Fix test without fr locale
Forwarded: not-needed
Reviewed-by: Pierre Gruet <pgt@debian.org>

---
 python/test/t_DataModel_std.expout |  1 -
 python/test/t_DataModel_std.py     | 21 ++++++++++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/python/test/t_DataModel_std.expout b/python/test/t_DataModel_std.expout
index 8c818ef9..4db7766b 100644
--- a/python/test/t_DataModel_std.expout
+++ b/python/test/t_DataModel_std.expout
@@ -834,4 +834,3 @@ myStudy.add(myDataModel3)
 aDataAnalysis = persalys.DataAnalysis('aDataAnalysis', myDataModel)
 myStudy.add(aDataAnalysis)
 
-[Année,Débit mesuré maximal (m3/s),Hauteur mesurée (m),Prévision modèle,Ecart donnée-modèle,H complet]
diff --git a/python/test/t_DataModel_std.py b/python/test/t_DataModel_std.py
index 76a415cd..7dd92748 100755
--- a/python/test/t_DataModel_std.py
+++ b/python/test/t_DataModel_std.py
@@ -78,8 +78,13 @@ exec(script)
 sample = ot.Normal(2).getSample(10)
 sample[0] = [1, 2]
 inColumns = [0, 1]
+have_fr_locale = True
 try:
     locale.setlocale(locale.LC_ALL, "fr_FR.utf8")
+except Exception:
+    have_fr_locale = False
+
+if have_fr_locale:
     for col_sep in [";", ",", " "]:
         for num_sep in [".", ","]:
             if col_sep == num_sep:
@@ -97,14 +102,12 @@ try:
                 "wrong dimension sep=" + col_sep
             )
             assert model.getSampleFromFile().getSize() == 10, "wrong size"
-except Exception:
-    # fr locale not available
-    pass
-os.remove(filename)
+    os.remove(filename)
 
-filename = "DonneesLatin1.csv"
-model4 = persalys.DataModel(
-    "myDataModel4", filename, [0, 1, 2, 3], [4, 5])
+    # test latin1 chars
+    filename = "DonneesLatin1.csv"
+    model4 = persalys.DataModel(
+        "myDataModel4", filename, [0, 1, 2, 3], [4, 5])
 
-myStudy.add(model4)
-print(model4.getSampleFromFile().getDescription())
+    myStudy.add(model4)
+    assert "Ann" in model4.getSampleFromFile().getDescription()[0]
-- 
2.34.1

