From c435d7ae24f1b80ce9d209e780d762febf1390a5 Mon Sep 17 00:00:00 2001 From: Vitaly Bogomolov Date: Thu, 27 Aug 2026 13:58:51 +0400 Subject: [PATCH 1/2] step --- history.txt | 2 ++ pipeline_csv/csvfile/defect.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/history.txt b/history.txt index 202682e..bcc8a0a 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,5 @@ +* If the pipe diameter is not specified, the dent depth as a percentage of the diameter is 0. + 27.08.2026 ver.1.27 ------------------- diff --git a/pipeline_csv/csvfile/defect.py b/pipeline_csv/csvfile/defect.py index 6a06d5b..116c6da 100644 --- a/pipeline_csv/csvfile/defect.py +++ b/pipeline_csv/csvfile/defect.py @@ -85,6 +85,8 @@ def depth_percent(self): # Depth.HundredthsOfMillimeter if self.is_dent: + if self.pipe.diameter is None: + return 0 return float(self.row.depth_max) / float(self.pipe.diameter) return float(self.row.depth_max) / (self.pipe.thick / 10.0) From 8d8688b1a92f8925d8c220b4f86fe6ed1575e730 Mon Sep 17 00:00:00 2001 From: Vitaly Bogomolov Date: Thu, 27 Aug 2026 14:07:30 +0400 Subject: [PATCH 2/2] step --- tests/test/test_csv/test_defect.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test/test_csv/test_defect.py b/tests/test/test_csv/test_defect.py index e5bcb9f..6a9feb4 100644 --- a/tests/test/test_csv/test_defect.py +++ b/tests/test/test_csv/test_defect.py @@ -89,6 +89,9 @@ def test_depth(self): # pylint: disable=too-many-statements assert mloss_defekt.depth_percent is None assert mloss_defekt.depth_mm is None + dent_defekt.pipe.diameter = None + assert dent_defekt.depth_percent == 0 + def test_props(self): # pylint: disable=too-many-statements """Check defekt properties.""" from pipeline_csv import TypeHorWeld