|
24 | 24 | "metadata": {}, |
25 | 25 | "source": [ |
26 | 26 | "There are various approaches to tests software:\n", |
27 | | - "- Assertions: 🦄 == 🦄\n", |
28 | | - "- Exceptions: within the code serve as ⚠️\n", |
29 | | - "- Unit tests: investigate the behaviour of units of code (e.g functions)\n", |
30 | | - "- Regression tests: defends against 🐛\n", |
31 | | - "- Integration tests: ⚙️ checks that the pieces work together as expected" |
| 27 | + "- **Assertions**: 🦄 == 🦄\n", |
| 28 | + "- **Exceptions**: within the code serve as warnings ⚠️\n", |
| 29 | + "- **Unit tests**: investigate the behaviour of units of code (e.g functions)\n", |
| 30 | + "- **Regression tests**: defends against 🐛\n", |
| 31 | + "- **Integration tests**: ⚙️ checks that the pieces work together as expected" |
32 | 32 | ] |
33 | 33 | }, |
34 | 34 | { |
|
50 | 50 | "And we will modify this function too:\n", |
51 | 51 | "```python\n", |
52 | 52 | "def get_country(filename, country):\n", |
53 | | - " \n", |
54 | | - "\n", |
55 | 53 | " # Load table\n", |
56 | 54 | " wine = pd.read_csv(filename)\n", |
57 | 55 | "\n", |
58 | 56 | " # Use the country name to subset data\n", |
59 | 57 | " subset_country = wine[wine['country'] == country ].copy()\n", |
60 | 58 | "\n", |
61 | | - " # Subset the\n", |
62 | | - "\n", |
63 | 59 | " # Constructing the fname\n", |
64 | 60 | " today = datetime.datetime.today().strftime('%Y-%m-%d')\n", |
65 | 61 | " fname = f'data/processed/{today}-winemag_{country}.csv'\n", |
|
76 | 72 | "cell_type": "markdown", |
77 | 73 | "metadata": {}, |
78 | 74 | "source": [ |
79 | | - "Now we need to create out testing scripts. \n", |
80 | | - "Some resources:\n", |
| 75 | + "Now we are going to create our testing suite. \n", |
| 76 | + "To run the tests we are going to use **pytest**.\n", |
| 77 | + "You can find more information in the following resources:\n", |
81 | 78 | "- Pytest usage examples can be found [here](http://doc.pytest.org/en/latest/usage.html)\n", |
82 | 79 | "- Rules for [test discovery](http://doc.pytest.org/en/latest/goodpractices.html)\n", |
83 | 80 | "\n", |
|
86 | 83 | "$ touch tests/__init__.py\n", |
87 | 84 | "$ touch test_03_country_subset.py\n", |
88 | 85 | "```\n", |
89 | | - "Your test scrips should start with `test`" |
| 86 | + "⭐ Your test scripts name must start with: `test`" |
90 | 87 | ] |
91 | 88 | }, |
92 | 89 | { |
|
0 commit comments