Skip to content

Commit 22a7091

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Fixes for typing tests
1 parent 251f303 commit 22a7091

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

tests/typing/test_benchmark_result_types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ def test_durations_is_tuple(self) -> None:
5858
class TestBenchmarkResultNegativeTypes:
5959
def test_percentile_zero_raises(self) -> None:
6060
result = make_result()
61-
with pytest.raises(ValueError):
61+
with pytest.raises(ValueError, match='percentile'):
6262
result.percentile(0)
6363

6464
def test_percentile_negative_raises(self) -> None:
6565
result = make_result()
66-
with pytest.raises(ValueError):
66+
with pytest.raises(ValueError, match='percentile'):
6767
result.percentile(-1)
6868

6969
def test_percentile_above_100_raises(self) -> None:
7070
result = make_result()
71-
with pytest.raises(ValueError):
71+
with pytest.raises(ValueError, match='percentile'):
7272
result.percentile(101)
7373

7474
def test_from_json_invalid_raises(self) -> None:
75-
with pytest.raises(Exception):
75+
with pytest.raises(json.JSONDecodeError):
7676
BenchmarkResult.from_json('{not valid}')
7777

7878
def test_from_json_empty_object_raises(self) -> None:
79-
with pytest.raises(Exception):
79+
with pytest.raises(ValueError, match='required fields'):
8080
BenchmarkResult.from_json('{}')

tests/typing/test_scenario_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def test_add_group_returns_group(self) -> None:
5959

6060
class TestScenarioNegativeTypes:
6161
def test_number_zero_raises(self) -> None:
62-
with pytest.raises(ValueError):
62+
with pytest.raises(ValueError, match='number'):
6363
Scenario(lambda: None, name='s', number=0)
6464

6565
def test_number_negative_raises(self) -> None:
66-
with pytest.raises(ValueError):
66+
with pytest.raises(ValueError, match='number'):
6767
Scenario(lambda: None, name='s', number=-5)
6868

6969
def test_add_int_returns_not_implemented(self) -> None:

0 commit comments

Comments
 (0)