From e3f1f395aa15c527c562faca44bfb5fe1f9b340c Mon Sep 17 00:00:00 2001 From: Krupeshgithub Date: Sat, 25 Nov 2023 13:29:28 +0530 Subject: [PATCH] fix: test josephus has add intiger list but passing string list --- tests/test_array.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/test_array.py b/tests/test_array.py index eaabfc710..afcdf547d 100644 --- a/tests/test_array.py +++ b/tests/test_array.py @@ -1,3 +1,4 @@ +from typing import List from algorithms.arrays import ( delete_nth, delete_nth_naive, flatten_iter, flatten, @@ -27,17 +28,17 @@ class TestJosephus(unittest.TestCase): def test_josephus(self): - a = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] - josephus_generator = josephus(a, 3) - self.assertEqual(next(josephus_generator), '3') - self.assertEqual(next(josephus_generator), '6') - self.assertEqual(next(josephus_generator), '9') - self.assertEqual(next(josephus_generator), '4') - self.assertEqual(next(josephus_generator), '8') - self.assertEqual(next(josephus_generator), '5') - self.assertEqual(next(josephus_generator), '2') - self.assertEqual(next(josephus_generator), '7') - self.assertEqual(next(josephus_generator), '1') + int_list: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + josephus_generator = josephus(int_list, 3) + self.assertEqual(next(josephus_generator), 3) + self.assertEqual(next(josephus_generator), 6) + self.assertEqual(next(josephus_generator), 9) + self.assertEqual(next(josephus_generator), 4) + self.assertEqual(next(josephus_generator), 8) + self.assertEqual(next(josephus_generator), 5) + self.assertEqual(next(josephus_generator), 2) + self.assertEqual(next(josephus_generator), 7) + self.assertEqual(next(josephus_generator), 1) self.assertRaises(StopIteration, next, josephus_generator)