11from dataclasses import dataclass
2+ from typing import ClassVar
23
34import pytest
45
5- from injection import LazyInstance , MappedScope , Scoped , injectable
6+ from injection import LazyInstance , MappedScope , injectable
67
78
89class _RawData : ...
@@ -18,12 +19,12 @@ class BindingsA:
1819 class BindingsB :
1920 scope = BindingsA .scope
2021
21- async def test_aopen_with_success (self , module ):
22+ async def test_adefine_with_success (self , module ):
2223 @dataclass
2324 class Bindings :
24- data : Scoped [ _RawData ]
25+ data : _RawData
2526
26- scope = MappedScope ("some_scope" , module = module )
27+ scope : ClassVar [ MappedScope ] = MappedScope ("some_scope" , module )
2728
2829 data = _RawData ()
2930 context = Bindings (data )
@@ -35,16 +36,15 @@ class Bindings:
3536
3637 assert module .get_instance (_RawData ) is NotImplemented
3738
38- def test_open_with_success (self , module ):
39+ def test_define_with_success (self , module ):
3940 @dataclass
4041 class Bindings :
41- data : Scoped [_RawData ]
42- unscoped_data : int
42+ data : _RawData
4343
44- scope = MappedScope ("some_scope" , module = module )
44+ scope : ClassVar [ MappedScope ] = MappedScope ("some_scope" , module )
4545
4646 data = _RawData ()
47- context = Bindings (data , 2 )
47+ context = Bindings (data )
4848
4949 assert module .get_instance (_RawData ) is NotImplemented
5050
@@ -54,13 +54,13 @@ class Bindings:
5454
5555 assert module .get_instance (_RawData ) is NotImplemented
5656
57- def test_open_with_optional_types (self , module ):
57+ def test_define_with_optional_types (self , module ):
5858 @dataclass
5959 class Bindings :
60- data : Scoped [ _RawData | None ] = None
61- name : Scoped [ str | None ] = None
60+ data : _RawData | None = None
61+ name : str | None = None
6262
63- scope = MappedScope ("some_scope" , module = module )
63+ scope : ClassVar [ MappedScope ] = MappedScope ("some_scope" , module )
6464
6565 data = _RawData ()
6666 context = Bindings (data )
0 commit comments