Coverage for tests/specification_test.py: 83%

1 import pytest

2

3 from diy.errors import MissingReturnTypeAnnotationError

4 from diy.specification import Specification

5

6

7 class Greeter:

8 def __init__(self, name: str) -> None:

9 self.name = name

10

11

12 def test_raises_exception_when_decorating_builder_functions_without_type_annotaions() -> (

13 None

14):

15 spec = Specification()

16

17 with pytest.raises(MissingReturnTypeAnnotationError):

18

19 @spec.builders.decorate

20 def greeter():

21 return Greeter("Example")