-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
final updates for documenting and testing
- Loading branch information
1 parent
3ae8ffa
commit 2384e46
Showing
26 changed files
with
183 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "ET: Debug Python (unittest)", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"program": "-m", | ||
"args": ["unittest", "${file}"], | ||
"console": "integratedTerminal", | ||
"justMyCode": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
def mystery_1(a): | ||
b = len(a) | ||
for c in range(b): | ||
for d in range(0, b - c - 1): | ||
if a[d] > a[d + 1]: | ||
a[d], a[d + 1] = a[d + 1], a[d] | ||
return a | ||
def mystery_1(a,b): | ||
return a + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
def mystery_2(a, b): | ||
c = [] | ||
while a: | ||
if b in a[0]: | ||
c.append(a[0]) | ||
a = a[1:] | ||
return c | ||
def mystery_2(a): | ||
if len(a) == 0: | ||
return None | ||
|
||
return len(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
def mystery_3(a, b=None): | ||
if b is None: | ||
b = [] | ||
while a: | ||
c = min(a) | ||
a.remove(c) | ||
b.append(c) | ||
return b | ||
def mystery_3(a, b): | ||
if a < b: | ||
return a | ||
elif a > b: | ||
return b | ||
else: | ||
return a + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
def mystery_4(a, b): | ||
c = [] | ||
for d in a: | ||
if b in d: | ||
c.append(d) | ||
return c | ||
def mystery_4(a): | ||
b = [] | ||
|
||
c = 0 | ||
while len(b) < a: | ||
b.append(c) | ||
c = c + 1 | ||
|
||
return b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def mystery_5(a, b=None): | ||
if b is None: | ||
b = [] | ||
while a: | ||
c = min(a) | ||
a.remove(c) | ||
b.append(c) | ||
return b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def mystery_6(a, b): | ||
if a == 0: | ||
return [] | ||
|
||
c = [] | ||
while len(c) < a: | ||
c.append(b) | ||
b = b + 1 | ||
|
||
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def mystery_7(a, b): | ||
c = [] | ||
for d in a: | ||
if b in d: | ||
c.append(d) | ||
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def mystery_8(a, b): | ||
c = [] | ||
while a: | ||
if b in a[0]: | ||
c.append(a[0]) | ||
a = a[1:] | ||
return c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def mystery_9(a): | ||
b = len(a) | ||
for c in range(b): | ||
for d in range(0, b - c - 1): | ||
if a[d] > a[d + 1]: | ||
a[d], a[d + 1] = a[d + 1], a[d] | ||
return a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_1 import mystery_1 | ||
|
||
class TestMystery1(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_2 import mystery_2 | ||
|
||
class TestMystery2(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_3 import mystery_3 | ||
|
||
class TestMystery3(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_4 import mystery_4 | ||
|
||
class TestMystery4(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_5 import mystery_5 | ||
|
||
class TestMystery5(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_6 import mystery_6 | ||
|
||
class TestMystery6(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_7 import mystery_7 | ||
|
||
class TestMystery7(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_8 import mystery_8 | ||
|
||
class TestMystery8(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
from ..mystery_9 import mystery_9 | ||
|
||
class TestMystery9(unittest.TestCase): | ||
""" """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
# Prep Work | ||
|
||
Familiarize yourself with these resources for understanding and discussing code quality: | ||
|
||
- Read through [Behavior, Strategy, Implementation](./behavior_strategy_implementation.md) | ||
- Read through the [Code Review Checklist](./code_review_checklist.md) | ||
|
||
Study and run the [`/examples`](./examples/). Practice using these _code quality automations_ with `fibonacci_list.py` and `tests/test_fibonacci.py`: | ||
|
||
- print the docstring: `$ python -m pydoc path/to/file.py` | ||
- run the doctests: `$ python -m doctest -v path/to/file.py` | ||
- run the unit tests: `$ python -m unittest path/to/tests/test_file.py` | ||
- stepping through unit tests following this process: | ||
- open `fibonacci_list.py` and `tests/test_fibonacci.py` side-by-side | ||
- place a breakpoint on the first line of the function | ||
- open the VSCode debugger pane | ||
- launch the `ET: Debug Python (unittest)` process | ||
|
||
Familiarize yourself these built-in Python tools for documenting and testing: | ||
|
||
- [Docstrings](https://peps.python.org/pep-0257/) | ||
- [Doctest](https://docs.python.org/3/library/doctest.html) | ||
- [The `uittest` module](https://docs.python.org/3/library/unittest.html) | ||
|
||
Familiarize yourself with these resources for understanding and discussing code quality: | ||
|
||
- Read through [Behavior, Strategy, Implementation](./behavior_strategy_implementation.md) | ||
- Read through the [Code Review Checklist](./code_review_checklist.md) | ||
- Study and run the [`/examples`](./examples/). Practice using these commands with `fibonacci_list.py` and `tests/test_fibonacci.py`: | ||
- print the docstring: `$ python -m pydoc path/to/file.py` | ||
- run the doctests: `$ python -m doctest -v path/to/file.py` | ||
- run the tests using `$ python -m unittest path/to/tests/test_file.py` |