Example #1
0
def test_strip_json_cruft_invalid():
    with pytest.raises(AttributeError):
        strip_json_cruft(None)
    with pytest.raises(fbchat.ParseError, match="No JSON object found"):
        strip_json_cruft("No JSON object here!")
Example #2
0
def test_strip_json_cruft():
    assert strip_json_cruft('for(;;);{"abc": "def"}') == '{"abc": "def"}'
    assert strip_json_cruft('{"abc": "def"}') == '{"abc": "def"}'