Esempio n. 1
0
def test_sympify_safety():
    "Parsing malformed strings throws exceptions instead of executing code."
    from sympy import sympify
    from pycalphad.io.tdb import _sympify_string

    teststr = "().__class__.__base__.__subclasses__()[216]('ls')"
    _sympify_string(teststr)  # should throw ParseException
Esempio n. 2
0
def test_sympify_safety():
    "Parsing malformed strings throws exceptions instead of executing code."
    from pycalphad.io.tdb import _sympify_string
    teststr = "().__class__.__base__.__subclasses__()[216]('ls')"
    _sympify_string(teststr)  # should throw ParseException
Esempio n. 3
0
def test_sympify_safety():
    "Parsing malformed strings throws exceptions instead of executing code."
    from pycalphad.io.tdb import _sympify_string
    teststr = "().__class__.__base__.__subclasses__()[216]('ls')"
    with pytest.raises(ValueError):
        _sympify_string(teststr)