|
| 1 | +# Acronym |
| 2 | + |
| 3 | +Convert a phrase to its acronym. |
| 4 | + |
| 5 | +Techies love their TLA (Three Letter Acronyms)! |
| 6 | + |
| 7 | +Help generate some jargon by writing a program that converts a long name |
| 8 | +like Portable Network Graphics to its acronym (PNG). |
| 9 | + |
| 10 | + |
| 11 | +## Exception messages |
| 12 | + |
| 13 | +Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to |
| 14 | +indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not |
| 15 | +every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include |
| 16 | +a message. |
| 17 | + |
| 18 | +To raise a message with an exception, just write it as an argument to the exception type. For example, instead of |
| 19 | +`raise Exception`, you should write: |
| 20 | + |
| 21 | +```python |
| 22 | +raise Exception("Meaningful message indicating the source of the error") |
| 23 | +``` |
| 24 | + |
| 25 | +## Running the tests |
| 26 | + |
| 27 | +To run the tests, run `pytest acronym_test.py` |
| 28 | + |
| 29 | +Alternatively, you can tell Python to run the pytest module: |
| 30 | +`python -m pytest acronym_test.py` |
| 31 | + |
| 32 | +### Common `pytest` options |
| 33 | + |
| 34 | +- `-v` : enable verbose output |
| 35 | +- `-x` : stop running tests on first failure |
| 36 | +- `--ff` : run failures from previous test before running other test cases |
| 37 | + |
| 38 | +For other options, see `python -m pytest -h` |
| 39 | + |
| 40 | +## Submitting Exercises |
| 41 | + |
| 42 | +Note that, when trying to submit an exercise, make sure the solution is in the `$EXERCISM_WORKSPACE/python/acronym` directory. |
| 43 | + |
| 44 | +You can find your Exercism workspace by running `exercism debug` and looking for the line that starts with `Workspace`. |
| 45 | + |
| 46 | +For more detailed information about running tests, code style and linting, |
| 47 | +please see [Running the Tests](http://exercism.io/tracks/python/tests). |
| 48 | + |
| 49 | +## Source |
| 50 | + |
| 51 | +Julien Vanier [https://github.com/monkbroc](https://github.com/monkbroc) |
| 52 | + |
| 53 | +## Submitting Incomplete Solutions |
| 54 | + |
| 55 | +It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
0 commit comments