From 548e84de1d9e22eb525a58cdda422eac83de34c5 Mon Sep 17 00:00:00 2001 From: Bhupendra Raut Date: Fri, 16 Aug 2024 15:22:08 -0500 Subject: [PATCH] this test fails --- app/MobotixScan.py | 3 ++- app/test_calculate_pt.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/MobotixScan.py b/app/MobotixScan.py index 7882c17..38910ee 100644 --- a/app/MobotixScan.py +++ b/app/MobotixScan.py @@ -38,7 +38,8 @@ def calculate_pt(sdir, pdir): for direction in pdir.upper().split(','): try: - value = (s_compensation + int(dir_lut[direction])) % 33 + value = (s_compensation + int(dir_lut[direction])) % 32 + if value == 0: value=32 pt_values.append(value) except KeyError: raise KeyError(f"Invalid direction '{direction}' provided. Use {dir_lut.keys()}") diff --git a/app/test_calculate_pt.py b/app/test_calculate_pt.py index 1e689d8..36ab642 100644 --- a/app/test_calculate_pt.py +++ b/app/test_calculate_pt.py @@ -5,7 +5,13 @@ class TestCalculatePt(unittest.TestCase): def test_case_1(self): sdir = 28 pdir = "SES,NEG" - expected = '20, 15' + expected = '21, 16' + self.assertEqual(calculate_pt(sdir, pdir), expected) + + def test_case_2(self): + sdir = 18 + pdir = "wh,SEG,ES,neb,NG,NES,eg" + expected = '26, 16, 9, 7, 4, 29, 28' self.assertEqual(calculate_pt(sdir, pdir), expected) def test_invalid_direction(self):