def test_eval_repr_invariant():
    random.seed(123)
    for dps in [10, 15, 20, 50, 100]:
        mp.dps = dps
        for i in range(1000):
            a = mpf(random.random())**0.5 * 10**random.randint(-100, 100)
            assert eval(repr(a)) == a
    mp.dps = 15
Test that eval(repr(x)) == x
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/tests/test_convert.py/test_eval_repr_invariant