def test_set_directions(self): test = WSdirections() test.set_directions(5) assert test.Chosen == [1, 4] test.set_directions(127) assert test.Chosen == [1, 2, 4, 8, 16, 32, 64] test.set_directions(255) assert test.Chosen == [ 1, 2, 4, 8, 16, 32, 64, 128]
def test_set_directions(self): test = WSdirections() test.set_directions(5) assert test.Chosen == [1, 4] test.set_directions(127) assert test.Chosen == [1, 2, 4, 8, 16, 32, 64] test.set_directions(255) assert test.Chosen == [1, 2, 4, 8, 16, 32, 64, 128]
def test_pop(self): test = WSdirections() test.set_directions(255) assert len(test.Chosen) == 8 local_dir = [] for i in range(0, len(test.Chosen)): local_dir.append(test.pop()) assert len(test.Chosen) == 0 for i in range(0, 100): test.set_directions(255) local_dir = [] for i in range(0, len(test.Chosen)): local_dir.append(test.pop()) test.set_directions(255) assert test.Chosen != local_dir