| 195 | |
| 196 | @pytest.mark.compiled |
| 197 | def test_manual_converter(): |
| 198 | res = helper.run( |
| 199 | { |
| 200 | "DC_CODE": "xl = pd.ExcelFile('battledeath2.xlsx')", |
| 201 | "DC_SOLUTION": "xl = pd.ExcelFile('battledeath.xlsx')", |
| 202 | "DC_PEC": "import pandas as pd; from urllib.request import urlretrieve; urlretrieve('https://s3.amazonaws.com/assets.datacamp.com/production/course_998/datasets/battledeath.xlsx', 'battledeath.xlsx'); from urllib.request import urlretrieve; urlretrieve('https://s3.amazonaws.com/assets.datacamp.com/production/course_998/datasets/battledeath.xlsx', 'battledeath2.xlsx')", |
| 203 | "DC_SCT": """ |
| 204 | def my_converter(x): return(x.sheet_names) |
| 205 | set_converter(key = "pandas.io.excel.ExcelFile", fundef = my_converter) |
| 206 | Ex().check_object('xl').has_equal_value() |
| 207 | """, |
| 208 | } |
| 209 | ) |
| 210 | assert res["correct"] |
| 211 | |
| 212 | |
| 213 | from pythonwhat.State import set_converter |