Merge pull request #293 from oalbe/master
Created LEARNING.md and TESTS.md.
This commit is contained in:
18
docs/LEARNING.md
Normal file
18
docs/LEARNING.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Learning Python From Scratch
|
||||
Python is, as Wikipedia goes, a powerful *general-purpose high-level programming language*. It basically means that it can be used to write a wide variety of different kinds of software, from videogames to HTTP servers to command-line tools.
|
||||
|
||||
One of the main characteristics that differentiates Python from other programming languages is its strong emphasis on readability and code cleaness. In fact, differently from other languages like JavaScript or C++, in Python code indentation has a syntactical meaning and you are forced to chose and adhere to a writing style (e.g. don't mix *tabs* and *spaces* for identation; don't use two spaces where you should use four etc.). Yes, forced: the Python interpreter will raise SyntaxErrors if it recognize wrong indentation.
|
||||
|
||||
This might look like a limit at the beginning but, as you will advance in your learning path, you'll realize that enforcing this behaviour will make your code slim and more readable by default.
|
||||
|
||||
For its own nature, exercism assumes that you already have a grasp of the language syntax before starting doing exercises. At least at a point where you can write simple functions in Python. From there on, you can continue your learning as you will advance in the exercism track and gradually explore new constructs and concepts.
|
||||
|
||||
With this premise, a good, beginner friendly, starting point for those who don't have any experience in other languages might be the Python course on [Codecademy.com](https://www.codecademy.com/). It will help you get an understanding of the Python syntax with which you will be able to start solving exercises here on exercism.
|
||||
|
||||
## Other Resources
|
||||
|
||||
- [Python3 Beginner Tutorial](https://www.youtube.com/playlist?list=PL1A2CSdiySGJd0LJRRSwQZbPZaDP0q67j)
|
||||
- [Learn Python The Hard Way (Book)](http://learnpythonthehardway.org/book/)
|
||||
- [Offical Python3 **Documentation** and **Reference**](https://docs.python.org/3/)
|
||||
- [Learn X in Y minutes (where X = Python3)](https://learnxinyminutes.com/docs/python3/)
|
||||
- [The Hitchhiker’s Guide to Python](http://docs.python-guide.org/en/latest/)
|
||||
33
docs/TESTS.md
Normal file
33
docs/TESTS.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Installing `pytest`
|
||||
|
||||
First of all, install `pytest` through `pip`.
|
||||
```
|
||||
pip3 install pytest
|
||||
```
|
||||
In case your system wouldn't be able to find `pip` and return a _command not found_, response, [here](https://pip.pypa.io/en/stable/installing/) you can find a tutorial on how to install it.
|
||||
|
||||
# Running the Tests
|
||||
|
||||
To run the tests for a specific exercise (we will take the `bob.py` exercise as an example here), place yourself in the directory where that exercise has been fetched and run:
|
||||
|
||||
```
|
||||
pytest bob_test.py
|
||||
```
|
||||
|
||||
This will run all the tests, wethere they fail or not. If you'd rather stop the process and exit on the first failure, run:
|
||||
|
||||
```
|
||||
pytest -x bob_test.py
|
||||
```
|
||||
|
||||
**Note:** To run the tests you have to pass the name of the testsuite file to `pytest` (generally, the file ending with `_test.py`), **NOT** the file you created to solve the problem (which is, your _implementation_). This because in the latter case, since there are no defined test cases in your implementation, `pytest` will just return a positive result, specifying that it ran zero tests. Like this:
|
||||
|
||||
```
|
||||
============================= bob.py ==============================
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Ran 0 tests in 0.000s
|
||||
|
||||
OK
|
||||
```
|
||||
Reference in New Issue
Block a user