Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ThriftGrammarError instead of Thrift GrammerError in tests #274

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from thriftpy2.thrift import TType
from thriftpy2.parser import load, load_fp
from thriftpy2.parser.exc import ThriftParserError, ThriftGrammerError
from thriftpy2.parser.exc import ThriftParserError, ThriftGrammarError


def test_comments():
Expand Down Expand Up @@ -216,9 +216,9 @@ def test_e_dead_include():
assert 'Dead including' in str(excinfo.value)


def test_e_grammer_error_at_eof():
with pytest.raises(ThriftGrammerError) as excinfo:
load('parser-cases/e_grammer_error_at_eof.thrift')
def test_e_grammar_error_at_eof():
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_grammar_error_at_eof.thrift')
assert str(excinfo.value) == 'Grammar error at EOF'


Expand All @@ -229,28 +229,28 @@ def test_e_use_thrift_reserved_keywords():


def test_e_duplicate_field_id_or_name():
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_field_id.thrift')
assert 'field identifier/name has already been used' in str(excinfo.value)
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_field_name.thrift')
assert 'field identifier/name has already been used' in str(excinfo.value)


def test_e_duplicate_struct_exception_service():
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_struct.thrift')
assert 'type is already defined in' in str(excinfo.value)
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_exception.thrift')
assert 'type is already defined in' in str(excinfo.value)
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_service.thrift')
assert 'type is already defined in' in str(excinfo.value)


def test_e_duplicate_function():
with pytest.raises(ThriftGrammerError) as excinfo:
with pytest.raises(ThriftGrammarError) as excinfo:
load('parser-cases/e_duplicate_function.thrift')
assert 'function is already defined in' in str(excinfo.value)

Expand Down
Loading