Browse Source

Corrections mineures

omassot 6 years ago
parent
commit
f6f2d35368
6 changed files with 15 additions and 7 deletions
  1. 1 1
      core/constants.py
  2. 1 1
      metadata.txt
  3. 4 2
      schemas/mn1_rec.py
  4. 3 1
      schemas/mn2_rec.py
  5. 3 1
      test/test_mn1_rec.py
  6. 3 1
      test/test_mn2_rec.py

+ 1 - 1
core/constants.py

@@ -6,7 +6,7 @@
 '''
 from path import Path
 
-VERSION = "0.8.0"
+VERSION = "0.8.1"
 
 MAIN = Path(__file__).parent.parent.abspath()
 

+ 1 - 1
metadata.txt

@@ -3,7 +3,7 @@
 name = MnCheck
 qgisminimumversion = 3.4
 description = Contrôle des données FTTH format MN
-version = 0.8.0
+version = 0.8.1
 author = Manche Numérique 2019
 email = sig@manchenumerique.fr
 about = Auto-contrôle des livrables FTTH aux formats Manche Numérique

+ 4 - 2
schemas/mn1_rec.py

@@ -324,8 +324,10 @@ class Mn1Checker(BaseChecker):
             for item in self.dataset[model]:
                 item_geom_type = item.get_geom_type()
                 if item_geom_type != model.geom_type:
-                    self.log_error(f"Type de géométrie invalide (attendu: {QgsModel.GEOM_NAMES[model.geom_type]}, trouvé: {QgsModel.GEOM_NAMES[item_geom_type]})", item=item)
-
+                    excected = QgsModel.GEOM_NAMES.get(model.geom_type, "(inconnue)")
+                    found = QgsModel.GEOM_NAMES.get(item_geom_type, "(inconnue)")
+                    self.log_error(f"Type de géométrie invalide (attendu: {excected}, trouvé: {found})", item=item)
+                    
     def test_bounding_box(self):
         """ Contrôle des emprises 
         Vérifie que les objets sont dans le périmètre attendu

+ 3 - 1
schemas/mn2_rec.py

@@ -344,7 +344,9 @@ class Mn2Checker(BaseChecker):
             for item in self.dataset[model]:
                 item_geom_type = item.get_geom_type()
                 if item_geom_type != model.geom_type:
-                    self.log_error(f"Type de géométrie invalide (attendu: {QgsModel.GEOM_NAMES[model.geom_type]}, trouvé: {QgsModel.GEOM_NAMES[item_geom_type]})", item=item)
+                    excected = QgsModel.GEOM_NAMES.get(model.geom_type, "(inconnue)")
+                    found = QgsModel.GEOM_NAMES.get(item_geom_type, "(inconnue)")
+                    self.log_error(f"Type de géométrie invalide (attendu: {excected}, trouvé: {found})", item=item)
 
     def test_bounding_box(self):
         """ Contrôle des emprises 

+ 3 - 1
test/test_mn1_rec.py

@@ -86,7 +86,9 @@ class Test(SchemaTest):
         self.assertEqual(len(r.errors), 0)
     
         # mauvaise projection
-        self.schema.Artere.layer.setCrs(QgsCoordinateReferenceSystem())
+        crs = QgsCoordinateReferenceSystem()
+        crs.createFromSrid(4473)
+        self.schema.Artere.layer.setCrs(crs)
         r = self.run_test("test_scr", True)
         
         self.assertFailure(r)

+ 3 - 1
test/test_mn2_rec.py

@@ -86,7 +86,9 @@ class Test(SchemaTest):
         self.assertEqual(len(r.errors), 0)
     
         # mauvaise projection
-        self.schema.Artere.layer.setCrs(QgsCoordinateReferenceSystem())
+        crs = QgsCoordinateReferenceSystem()
+        crs.createFromSrid(4473)
+        self.schema.Artere.layer.setCrs(crs)
         r = self.run_test("test_scr", True)
         
         self.assertFailure(r)