|
207 | 207 | },
|
208 | 208 | {
|
209 | 209 | "cell_type": "code",
|
210 |
| - "execution_count": 3, |
| 210 | + "execution_count": 2, |
211 | 211 | "metadata": {},
|
212 | 212 | "outputs": [
|
213 | 213 | {
|
|
218 | 218 | "============================================= FAILURES =============================================\n",
|
219 | 219 | "\u001b[31m\u001b[1m_________________________________________ test_num_inputs __________________________________________\u001b[0m\n",
|
220 | 220 | "\n",
|
221 |
| - "tree = <ast.Module object at 0x109a5a860>\n", |
| 221 | + "tree = <ast.Module object at 0x10e7da1a0>\n", |
222 | 222 | "\n",
|
223 | 223 | " \u001b[94mdef\u001b[39;49;00m \u001b[92mtest_num_inputs\u001b[39;49;00m(tree):\n",
|
224 |
| - " checker = InputChecker()\n", |
| 224 | + " checker = FuncCallChecker(\u001b[33m\"\u001b[39;49;00m\u001b[33minput\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m)\n", |
225 | 225 | " checker.visit(tree)\n",
|
226 | 226 | " \n",
|
227 |
| - "> \u001b[94massert\u001b[39;49;00m checker.num_inputs >= \u001b[94m8\u001b[39;49;00m, \u001b[33m\"\u001b[39;49;00m\u001b[33myou don\u001b[39;49;00m\u001b[33m'\u001b[39;49;00m\u001b[33mt have enough calls to input()\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\n", |
| 227 | + "> \u001b[94massert\u001b[39;49;00m checker.num_calls >= \u001b[94m8\u001b[39;49;00m, \u001b[33m\"\u001b[39;49;00m\u001b[33myou don\u001b[39;49;00m\u001b[33m'\u001b[39;49;00m\u001b[33mt have enough calls to input()\u001b[39;49;00m\u001b[33m\"\u001b[39;49;00m\n", |
228 | 228 | "\u001b[1m\u001b[31mE AssertionError: you don't have enough calls to input()\u001b[0m\n",
|
229 | 229 | "\u001b[1m\u001b[31mE assert 2 >= 8\u001b[0m\n",
|
230 |
| - "\u001b[1m\u001b[31mE + where 2 = <extras.scripts.hw_0_helper.InputChecker object at 0x10acc9ba0>.num_inputs\u001b[0m\n", |
| 230 | + "\u001b[1m\u001b[31mE + where 2 = <extras.scripts.hw_0_helper.FuncCallChecker object at 0x10e7d8df0>.num_calls\u001b[0m\n", |
| 231 | + "\n", |
| 232 | + "\u001b[1m\u001b[31m/var/folders/kg/1ys0dccx4237f5wsd_w10dt80000gn/T/ipykernel_68325/4145485001.py\u001b[0m:8: AssertionError\n", |
| 233 | + "\u001b[33m========================================= warnings summary =========================================\u001b[0m\n", |
| 234 | + "tmpc439hpt9.py::test_num_inputs\n", |
| 235 | + " /usr/local/Caskroom/miniconda/base/envs/python-public-policy/lib/python3.10/site-packages/IPython/core/inputsplitter.py:21: DeprecationWarning: IPython.core.inputsplitter is deprecated since IPython 7 in favor of `IPython.core.inputtransformer2`\n", |
| 236 | + " warn('IPython.core.inputsplitter is deprecated since IPython 7 in favor of `IPython.core.inputtransformer2`',\n", |
231 | 237 | "\n",
|
232 |
| - "\u001b[1m\u001b[31m/var/folders/kg/1ys0dccx4237f5wsd_w10dt80000gn/T/ipykernel_67029/2901258849.py\u001b[0m:8: AssertionError\n", |
| 238 | + "-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html\n", |
233 | 239 | "===================================== short test summary info ======================================\n",
|
234 |
| - "FAILED tmpyoyk9z3m.py::test_num_inputs - AssertionError: you don't have enough calls to input()\n" |
| 240 | + "FAILED tmpc439hpt9.py::test_num_inputs - AssertionError: you don't have enough calls to input()\n" |
235 | 241 | ]
|
236 | 242 | }
|
237 | 243 | ],
|
|
242 | 248 | "\n",
|
243 | 249 | "\n",
|
244 | 250 | "def test_num_inputs(tree):\n",
|
245 |
| - " checker = InputChecker()\n", |
| 251 | + " checker = FuncCallChecker(\"input\")\n", |
246 | 252 | " checker.visit(tree)\n",
|
247 | 253 | "\n",
|
248 |
| - " assert checker.num_inputs >= 8, \"you don't have enough calls to input()\"" |
| 254 | + " assert checker.num_calls >= 8, \"you don't have enough calls to input()\"" |
249 | 255 | ]
|
250 | 256 | },
|
251 | 257 | {
|
|
0 commit comments