def test_read_nonexistent_file(self): grammar = AntlrGrammar(pathlib.Path('FooBar.g4')) # check if DistutilsFileError was thrown with pytest.raises(distutils.errors.DistutilsFileError) as excinfo: grammar.read_imports() assert excinfo.match('FooBar.g4')
def test_read_nonexistent_file(self): grammar = AntlrGrammar(pathlib.Path('FooBar.g4')) # check if DistutilsFileError was thrown with pytest.raises(distutils.errors.DistutilsFileError) as excinfo: grammar.read_imports() assert excinfo.match('FooBar.g4')
def test_read_without_imports(self): grammar = AntlrGrammar( pathlib.Path('distributed', 'CommonTerminals.g4')) imports = grammar.read_imports() assert not imports
def test_read_with_imports(self): grammar = AntlrGrammar(pathlib.Path('distributed', 'SomeGrammar.g4')) imports = set(grammar.read_imports()) assert len(imports) == 2 assert {'CommonTerminals', 'SharedRules'} == imports
def test_read_without_imports(self): grammar = AntlrGrammar(pathlib.Path('distributed', 'CommonTerminals.g4')) imports = grammar.read_imports() assert not imports
def test_read_with_imports(self): grammar = AntlrGrammar(pathlib.Path('distributed', 'SomeGrammar.g4')) imports = set(grammar.read_imports()) assert len(imports) == 2 assert {'CommonTerminals', 'SharedRules'} == imports