| 1 |
# This test code was written by the `hypothesis.extra.ghostwriter` module |
| 2 |
# and is provided under the Creative Commons Zero public domain dedication. |
| 3 |
|
| 4 |
import ast |
| 5 |
from hypothesis import given, strategies as st |
| 6 |
|
| 7 |
# TODO: replace st.nothing() with an appropriate strategy |
| 8 |
|
| 9 |
|
| 10 |
@given( |
| 11 |
globals=st.none(), locals=st.none(), node_or_string=st.text(), source=st.nothing() |
| 12 |
) |
| 13 |
def test_equivalent_eval_literal_eval(globals, locals, node_or_string, source): |
| 14 |
result_eval = eval(source, globals, locals) |
| 15 |
result_literal_eval = ast.literal_eval(node_or_string=node_or_string) |
| 16 |
assert result_eval == result_literal_eval, (result_eval, result_literal_eval) |