generated from jCloud/repository-template
style: format source code using Ruff
This commit is contained in:
41 files changed
+6061
-5670
No files matched your search
@@ -16,47 +16,58 @@ from src.jcloud_docsgen.utils import assert_that_is_instance
|
||||
import pytest
|
||||
import types
|
||||
|
||||
|
||||
class TestType: ...
|
||||
|
||||
|
||||
TestType.__name__ = 'NOT TestType'
|
||||
|
||||
@pytest.mark.parametrize('obj,class_or_tuple', [
|
||||
(1, int),
|
||||
(1, (int,)),
|
||||
(1, str | int),
|
||||
(1, int | str | list),
|
||||
(TestType(), TestType),
|
||||
(None, types.NoneType),
|
||||
])
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'obj,class_or_tuple',
|
||||
[
|
||||
(1, int),
|
||||
(1, (int,)),
|
||||
(1, str | int),
|
||||
(1, int | str | list),
|
||||
(TestType(), TestType),
|
||||
(None, types.NoneType),
|
||||
],
|
||||
)
|
||||
def test_assert_that_is_instance(obj, class_or_tuple):
|
||||
assert_that_is_instance(obj, class_or_tuple)
|
||||
|
||||
@pytest.mark.parametrize('obj,class_or_tuple,expected_exception_msg', [
|
||||
(
|
||||
1,
|
||||
str,
|
||||
'expected \'str\', got \'int\'',
|
||||
),
|
||||
(
|
||||
1,
|
||||
(str,),
|
||||
'expected \'str\', got \'int\'',
|
||||
),
|
||||
(
|
||||
1,
|
||||
str | float,
|
||||
'expected either \'str\' or \'float\', got \'int\'',
|
||||
),
|
||||
(
|
||||
1,
|
||||
str | float | list,
|
||||
'expected either \'str\', \'float\' or \'list\', got \'int\'',
|
||||
),
|
||||
(
|
||||
1,
|
||||
TestType,
|
||||
'expected \'NOT TestType\', got \'int\'',
|
||||
),
|
||||
])
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'obj,class_or_tuple,expected_exception_msg',
|
||||
[
|
||||
(
|
||||
1,
|
||||
str,
|
||||
"expected 'str', got 'int'",
|
||||
),
|
||||
(
|
||||
1,
|
||||
(str,),
|
||||
"expected 'str', got 'int'",
|
||||
),
|
||||
(
|
||||
1,
|
||||
str | float,
|
||||
"expected either 'str' or 'float', got 'int'",
|
||||
),
|
||||
(
|
||||
1,
|
||||
str | float | list,
|
||||
"expected either 'str', 'float' or 'list', got 'int'",
|
||||
),
|
||||
(
|
||||
1,
|
||||
TestType,
|
||||
"expected 'NOT TestType', got 'int'",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_assert_that_is_instance_exceptions(
|
||||
obj,
|
||||
class_or_tuple,
|
||||
|
||||
Reference in new issue
Block a user