mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 05:14:29 +08:00
Load newest grammar in face of a future grammar
This commit is contained in:
@@ -4,15 +4,21 @@ from parso import utils
|
||||
|
||||
|
||||
def test_load_inexisting_grammar():
|
||||
# This version shouldn't be out for a while, but if we ever do, wow!
|
||||
with pytest.raises(NotImplementedError):
|
||||
load_grammar(version='15.8')
|
||||
# The same is true for very old grammars (even though this is probably not
|
||||
# going to be an issue.
|
||||
# We support future grammars assuming future compatibility,
|
||||
# but we don't know how to parse old grammars.
|
||||
with pytest.raises(NotImplementedError):
|
||||
load_grammar(version='1.5')
|
||||
|
||||
|
||||
def test_load_grammar_uses_older_syntax():
|
||||
with pytest.warns():
|
||||
load_grammar(version='4.0')
|
||||
|
||||
|
||||
def test_load_grammar_doesnt_warn(each_version):
|
||||
load_grammar(version=each_version)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('string', 'result'), [
|
||||
('2', (2, 7)), ('3', (3, 6)), ('1.1', (1, 1)), ('1.1.1', (1, 1)), ('300.1.31', (300, 1))
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user