Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ponicode.testSettings.testLocation.locationType": "Same folder as source file",
"ponicode.testSettings.testLocation.path": "{rootDir}/{filePath}/{fileName}.test.{ext}"
"ponicode.testSettings.testLocation.path": "{rootDir}/{filePath}/{fileName}.test.{ext}",
"python.pythonPath": ".venv/bin/python3.9"
}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# data-structures-and-algorithms-python
# data-structures-and-algorithms-python
# Challenge Summary
IT was eady
## Challenge Description
I did a tests to a shift array
## Approach & Efficiency
TDD
## Solution
![Getting Started](dddddddddddd.png)
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def array_shift(l,b):
middle = len(l) // 2
if len(l) % 2 == 0:

return l[:middle] + [b] + l[middle:]
else:
return l[:middle + 1] + [b] + l[middle +1:]

Binary file not shown.
Binary file not shown.
Binary file added dddddddddddd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 0 additions & 10 deletions tests/challenges/test_array_reverse.py

This file was deleted.

49 changes: 49 additions & 0 deletions tests/challenges/test_array_shift.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# put your array_reverse challenge tests here
from data_structures_and_algorithms.challenges.array_reverse.array_shift import array_shift


# "Happy Path" cases
# test should pass for array with number of even element where elements are integers
def test_one():
expected = [1,2,5,3,4]
actual = array_shift([1,2,3,4],5)
assert actual == expected

# test should pass for array with number of even element where elements are letters
def test_two():
expected = ['a','b','z','c','d']
actual = array_shift(['a','b','c','d'],'z')
assert actual == expected

# test should pass for array with odd number of elements where elements are letters and integers
def test_three():
expected = [1,2,3,'a',4,5]
actual = array_shift([1,2,3,4,5],'a')
assert actual == expected



# Edge Case
# test should pass for initial array with only 2 elements
def test_four():
expected = [1,2,1]
actual = array_shift([1,1],2)
assert actual == expected



# Expected Failure
# test should pass for initial array with elements ptinted with spaces
def test_five():
expected = [1,2,9,3]
actual = array_shift([ 1 , 2 , 3 ],9)
assert actual == expected

# test should pass for initial array with only one element
def test_six():
expected = [1,2]
actual = array_shift([1],2)
assert actual == expected



Binary file not shown.