def test_differentiator_flags_for_nonsmooth_and_discontinuous():
    import pymbolic.functions as pf
    from pymbolic.mapper.differentiator import differentiate
    x = prim.Variable('x')
    with pytest.raises(ValueError):
        differentiate(pf.fabs(x), x)
    result = differentiate(pf.fabs(x), x, allowed_nonsmoothness='continuous')
    assert (result == pf.sign(x))
    with pytest.raises(ValueError):
        differentiate(pf.sign(x), x)
    result = differentiate(pf.sign(x), x, allowed_nonsmoothness='discontinuous')
    assert (result == 0)
def test_differentiator_flags_for_nonsmooth_and_discontinuous():
    import pymbolic.functions as pf
    from pymbolic.mapper.differentiator import differentiate
    x = prim.Variable('x')
    with pytest.raises(ValueError):
        differentiate(pf.fabs(x), x)
    result = differentiate(pf.fabs(x), x, allowed_nonsmoothness='continuous')
    assert (result == pf.sign(x))
    with pytest.raises(ValueError):
        differentiate(pf.sign(x), x)
    result = differentiate(pf.sign(x), x, allowed_nonsmoothness='discontinuous')
    assert (result == 0)