py-xbc/tests/test_invalid.py

44 lines
896 B
Python
Raw Normal View History

2024-01-13 06:44:43 +00:00
import pytest
from pyparsing.exceptions import ParseException
from xbc import loads_xbc, ParseError
# this should fail but does not.
@pytest.mark.xfail
def test_whitespace_vc():
with pytest.raises(ParseError):
loads_xbc('x = a\n, b')
# this should fail but does not.
@pytest.mark.xfail
def test_extra_quote():
with pytest.raises(ParseException):
loads_xbc("x = '''")
def test_lone_plus():
with pytest.raises(ParseException):
loads_xbc('+')
def test_lone_rbrace():
with pytest.raises(ParseException):
loads_xbc('}')
def test_lone_lbrace():
with pytest.raises(ParseException):
loads_xbc('{')
def test_lone_braces():
with pytest.raises(ParseException):
loads_xbc('{}')
def test_lone_semi():
with pytest.raises(ParseException):
loads_xbc(';')
def test_empty():
with pytest.raises(ParseException):
loads_xbc('\n')
with pytest.raises(ParseException):
loads_xbc('')