|
16 | 16 | "name": "stdout", |
17 | 17 | "output_type": "stream", |
18 | 18 | "text": [ |
19 | | - "Overwriting first.py\n" |
| 19 | + "Writing first.py\n" |
20 | 20 | ] |
21 | 21 | } |
22 | 22 | ], |
|
42 | 42 | "source": [ |
43 | 43 | "%%writefile -a first.py\n", |
44 | 44 | "\n", |
45 | | - "\n", |
46 | 45 | "# This is appended to the file.\n", |
47 | 46 | "def test_first():\n", |
48 | 47 | " assert first([1, 2, 3]) == 1" |
|
57 | 56 | "name": "stdout", |
58 | 57 | "output_type": "stream", |
59 | 58 | "text": [ |
60 | | - "def first(l):\n", |
61 | | - " return l[0]\n", |
62 | | - "\n", |
63 | | - "# This is appended to the file.\n", |
64 | | - "def test_first():\n", |
65 | | - " assert first([1, 2, 3]) == 1\n" |
| 59 | + "def first(l):\r\n", |
| 60 | + " return l[0]\r\n", |
| 61 | + "\r\n", |
| 62 | + "# This is appended to the file.\r\n", |
| 63 | + "def test_first():\r\n", |
| 64 | + " assert first([1, 2, 3]) == 1\r\n" |
66 | 65 | ] |
67 | 66 | } |
68 | 67 | ], |
|
79 | 78 | "name": "stdout", |
80 | 79 | "output_type": "stream", |
81 | 80 | "text": [ |
82 | | - "============= test session starts ==============\n", |
83 | | - "platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34\n", |
84 | | - "rootdir: ~/git/cookbook-2nd/chapter02_best_practices:\n", |
85 | | - "plugins: cov-2.5.1\n", |
86 | | - "\n", |
87 | | - "collecting 0 items\n", |
88 | | - "collecting 1 item\n", |
89 | | - "collected 1 item\n", |
90 | | - "\n", |
91 | | - "first.py .\n", |
92 | | - "\n", |
93 | | - "=========== 1 passed in 0.00 seconds ===========\n" |
| 81 | + "\u001b[1m============================= test session starts ==============================\u001b[0m\r\n", |
| 82 | + "platform darwin -- Python 3.8.0, pytest-5.3.5, py-1.8.1, pluggy-0.13.1\r\n", |
| 83 | + "rootdir: /Users/yihanc/repositories/personal/cookbook-2nd-code/chapter02_best_practices\r\n", |
| 84 | + "\u001b[1mcollecting ... \u001b[0m\u001b[1m\r", |
| 85 | + "collected 1 item \u001b[0m\r\n", |
| 86 | + "\r\n", |
| 87 | + "first.py \u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\r\n", |
| 88 | + "\r\n", |
| 89 | + "\u001b[32m============================== \u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.01s\u001b[0m\u001b[32m ===============================\u001b[0m\r\n" |
94 | 90 | ] |
95 | 91 | } |
96 | 92 | ], |
|
130 | 126 | "name": "stdout", |
131 | 127 | "output_type": "stream", |
132 | 128 | "text": [ |
133 | | - "============= test session starts ==============\n", |
134 | | - "platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34\n", |
135 | | - "rootdir: ~/git/cookbook-2nd/chapter02_best_practices:\n", |
136 | | - "plugins: cov-2.5.1\n", |
| 129 | + "\u001b[1m============================= test session starts ==============================\u001b[0m\n", |
| 130 | + "platform darwin -- Python 3.8.0, pytest-5.3.5, py-1.8.1, pluggy-0.13.1\n", |
| 131 | + "rootdir: /Users/yihanc/repositories/personal/cookbook-2nd-code/chapter02_best_practices\n", |
| 132 | + "collected 1 item \u001b[0m\n", |
137 | 133 | "\n", |
138 | | - "collecting 0 items\n", |
139 | | - "collecting 1 item\n", |
140 | | - "collected 1 item\n", |
| 134 | + "first.py \u001b[31mF\u001b[0m\u001b[31m [100%]\u001b[0m\n", |
141 | 135 | "\n", |
142 | | - "first.py F\n", |
| 136 | + "=================================== FAILURES ===================================\n", |
| 137 | + "\u001b[31m\u001b[1m__________________________________ test_first __________________________________\u001b[0m\n", |
143 | 138 | "\n", |
144 | | - "=================== FAILURES ===================\n", |
145 | | - "__________________ test_first __________________\n", |
| 139 | + "\u001b[1m def test_first():\u001b[0m\n", |
| 140 | + "\u001b[1m assert first([1, 2, 3]) == 1\u001b[0m\n", |
| 141 | + "\u001b[1m> assert first([]) is None\u001b[0m\n", |
146 | 142 | "\n", |
147 | | - " def test_first():\n", |
148 | | - " assert first([1, 2, 3]) == 1\n", |
149 | | - "> assert first([]) is None\n", |
150 | | - "\n", |
151 | | - "first.py:6:\n", |
152 | | - " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n", |
| 143 | + "\u001b[1m\u001b[31mfirst.py\u001b[0m:6: \n", |
| 144 | + "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n", |
153 | 145 | "\n", |
154 | 146 | "l = []\n", |
155 | 147 | "\n", |
156 | | - " def first(l):\n", |
157 | | - "> return l[0]\n", |
158 | | - "E IndexError: list index out of range\n", |
| 148 | + "\u001b[1m def first(l):\u001b[0m\n", |
| 149 | + "\u001b[1m> return l[0]\u001b[0m\n", |
| 150 | + "\u001b[1m\u001b[31mE IndexError: list index out of range\u001b[0m\n", |
159 | 151 | "\n", |
160 | | - "first.py:2: IndexError\n", |
161 | | - "=========== 1 failed in 0.02 seconds ===========\n" |
| 152 | + "\u001b[1m\u001b[31mfirst.py\u001b[0m:2: IndexError\n", |
| 153 | + "\u001b[31m============================== \u001b[31m\u001b[1m1 failed\u001b[0m\u001b[31m in 0.05s\u001b[0m\u001b[31m ===============================\u001b[0m\n" |
162 | 154 | ] |
163 | 155 | } |
164 | 156 | ], |
|
198 | 190 | "name": "stdout", |
199 | 191 | "output_type": "stream", |
200 | 192 | "text": [ |
201 | | - "============= test session starts ==============\n", |
202 | | - "platform linux -- Python 3.6.3, pytest-3.2.1, py-1.4.34\n", |
203 | | - "rootdir: ~/git/cookbook-2nd/chapter02_best_practices:\n", |
204 | | - "plugins: cov-2.5.1\n", |
205 | | - "\n", |
206 | | - "collecting 0 items\n", |
207 | | - "collecting 1 item\n", |
208 | | - "collected 1 item\n", |
209 | | - "\n", |
210 | | - "first.py .\n", |
211 | | - "\n", |
212 | | - "=========== 1 passed in 0.00 seconds ===========\n" |
| 193 | + "\u001b[1m============================= test session starts ==============================\u001b[0m\r\n", |
| 194 | + "platform darwin -- Python 3.8.0, pytest-5.3.5, py-1.8.1, pluggy-0.13.1\r\n", |
| 195 | + "rootdir: /Users/yihanc/repositories/personal/cookbook-2nd-code/chapter02_best_practices\r\n", |
| 196 | + "\u001b[1mcollecting ... \u001b[0m\u001b[1m\r", |
| 197 | + "collected 1 item \u001b[0m\r\n", |
| 198 | + "\r\n", |
| 199 | + "first.py \u001b[32m.\u001b[0m\u001b[32m [100%]\u001b[0m\r\n", |
| 200 | + "\r\n", |
| 201 | + "\u001b[32m============================== \u001b[32m\u001b[1m1 passed\u001b[0m\u001b[32m in 0.01s\u001b[0m\u001b[32m ===============================\u001b[0m\r\n" |
213 | 202 | ] |
214 | 203 | } |
215 | 204 | ], |
|
218 | 207 | ] |
219 | 208 | } |
220 | 209 | ], |
221 | | - "metadata": {}, |
| 210 | + "metadata": { |
| 211 | + "kernelspec": { |
| 212 | + "display_name": "Python 3", |
| 213 | + "language": "python", |
| 214 | + "name": "python3" |
| 215 | + }, |
| 216 | + "language_info": { |
| 217 | + "codemirror_mode": { |
| 218 | + "name": "ipython", |
| 219 | + "version": 3 |
| 220 | + }, |
| 221 | + "file_extension": ".py", |
| 222 | + "mimetype": "text/x-python", |
| 223 | + "name": "python", |
| 224 | + "nbconvert_exporter": "python", |
| 225 | + "pygments_lexer": "ipython3", |
| 226 | + "version": "3.7.4" |
| 227 | + } |
| 228 | + }, |
222 | 229 | "nbformat": 4, |
223 | 230 | "nbformat_minor": 2 |
224 | 231 | } |
0 commit comments