tests/test_basic.py: test fixes

current
Síle Ekaterin Liszka 2024-01-12 14:56:56 -08:00
parent be69396f69
commit ed8a3ebcf4
Signed by: VulpineAmethyst
SSH Key Fingerprint: SHA256:VcHwQ6SUfi/p0Csfxe3SabX/TImWER0PhoJqkt+GlmE
1 changed files with 3 additions and 6 deletions

View File

@ -3,7 +3,7 @@ import pytest
from xbc import loads_xbc, ParseError from xbc import loads_xbc, ParseError
class TestBare: class TestBareLoad:
def test_key(self): def test_key(self):
assert loads_xbc('a') == {'a': True} assert loads_xbc('a') == {'a': True}
@ -26,7 +26,7 @@ class TestBare:
assert loads_xbc('a.a;a.b') == {'a.a': True, 'a.b': True} assert loads_xbc('a.a;a.b') == {'a.a': True, 'a.b': True}
def test_string(self): def test_string(self):
assert loads_xbc('a = "b"') == {'a': '"b"'} assert loads_xbc('a = "b"') == {'a': 'b'}
def test_array(self): def test_array(self):
assert loads_xbc('a = 1, 2') == {'a': ['1', '2']} assert loads_xbc('a = 1, 2') == {'a': ['1', '2']}
@ -35,9 +35,6 @@ class TestBare:
with pytest.raises(ParseError): with pytest.raises(ParseError):
loads_xbc('a = 1\na = 2') loads_xbc('a = 1\na = 2')
# currently the lexer doesn't correctly parse keyvalues with semis
# outside of blocks. no idea why.
@pytest.mark.xfail
def test_reassignment_colon(self): def test_reassignment_colon(self):
with pytest.raises(ParseError): with pytest.raises(ParseError):
loads_xbc('a = 1;a = 2') loads_xbc('a = 1;a = 2')
@ -46,7 +43,7 @@ class TestBare:
with pytest.raises(ParseError): with pytest.raises(ParseError):
loads_xbc('a := 1') loads_xbc('a := 1')
class TestBlock: class TestBlockLoad:
def test_keyvalue(self): def test_keyvalue(self):
assert loads_xbc('a { a = 1 }') == {'a': False, 'a.a': '1'} assert loads_xbc('a { a = 1 }') == {'a': False, 'a.a': '1'}