()
| 2 | |
| 3 | |
| 4 | def test_code_extract(): |
| 5 | test_simple = r"""Here is some python code generated |
| 6 | import numpy as np |
| 7 | Sorry, I made a mistake, let me try again |
| 8 | from numpy import sin, cos, tan |
| 9 | |
| 10 | def f(x): |
| 11 | return tan(x) |
| 12 | As you can observe from above |
| 13 | """ |
| 14 | assert ( |
| 15 | code_extract(test_simple) |
| 16 | == r"""from numpy import sin, cos, tan |
| 17 | |
| 18 | def f(x): |
| 19 | return tan(x)""" |
| 20 | ) |
| 21 | |
| 22 | test_empty_lines = r"""import numpy as np |
| 23 | |
| 24 | |
| 25 | import pandas |
| 26 | Sorry, let me try again |
| 27 | from numpy import sin, cos, tan |
| 28 | def f(x): |
| 29 | return tan(x) |
| 30 | """ |
| 31 | assert ( |
| 32 | code_extract(test_empty_lines) |
| 33 | == r"""from numpy import sin, cos, tan |
| 34 | def f(x): |
| 35 | return tan(x)""" |
| 36 | ) |
| 37 | |
| 38 | |
| 39 | def test_sanitize_simple(): |
nothing calls this directly
no test coverage detected