Skip to content

Commit

Permalink
this test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
RBhupi committed Aug 16, 2024
1 parent fd0af33 commit 548e84d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/MobotixScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")
Expand Down
8 changes: 7 additions & 1 deletion app/test_calculate_pt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 548e84d

Please sign in to comment.