Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test josephus has add intiger list but passing string list #909

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions tests/test_array.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import List
from algorithms.arrays import (
delete_nth, delete_nth_naive,
flatten_iter, flatten,
Expand Down Expand Up @@ -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)


Expand Down