Skip to content

Commit

Permalink
Using ThriftGrammarError instead of Thrift GrammerError in tests (#274)
Browse files Browse the repository at this point in the history
* Using ThriftGrammarError instead of Thrift GrammerError in tests

* Continue fix
  • Loading branch information
aisk authored Jun 12, 2024
1 parent 2c449dc commit 07aa2d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
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

0 comments on commit 07aa2d5

Please sign in to comment.