Skip to content

Commit 3ccbe0f

Browse files
jsouterGDYendell
authored andcommitted
fixes after rebase
1 parent 446f047 commit 3ccbe0f

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/fastcs/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def validate_hinted_attributes(controller: BaseController):
4848
attr_dtype = None
4949
else:
5050
attr_class = get_origin(hint)
51-
(attr_dtype,) = get_args(hint)
51+
attr_dtype = get_args(hint)[0]
5252
if not issubclass(attr_class, Attribute):
5353
continue
5454
attr = getattr(controller, name, None)

tests/test_util.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pydantic import ValidationError
88

99
from fastcs.attributes import Attribute, AttrR, AttrRW
10-
from fastcs.backend import Backend
1110
from fastcs.controller import Controller
1211
from fastcs.datatypes import Bool, Enum, Float, Int, String
1312
from fastcs.launch import FastCS
@@ -134,13 +133,13 @@ async def initialise(self):
134133
self.hinted = AttrR(Int())
135134

136135
# no assertion thrown
137-
Backend(ControllerUnspecifiedAccessMode(), loop)
136+
FastCS(ControllerUnspecifiedAccessMode(), [], loop)
138137

139138

140139
def test_hinted_attributes_verified_on_subcontrollers():
141140
loop = asyncio.get_event_loop()
142141

143-
class ControllerWithWrongType(SubController):
142+
class ControllerWithWrongType(Controller):
144143
hinted_missing: AttrR[int]
145144

146145
async def connect(self):
@@ -152,7 +151,7 @@ async def initialise(self):
152151
self.register_sub_controller("MySubController", subcontroller)
153152

154153
with pytest.raises(RuntimeError, match="failed to introspect hinted attribute"):
155-
Backend(TopController(), loop)
154+
FastCS(TopController(), [], loop)
156155

157156

158157
def test_hinted_attribute_types_verified():
@@ -166,12 +165,12 @@ async def initialise(self):
166165
self.read_attr = AttrRW(Int())
167166

168167
with pytest.raises(RuntimeError, match="does not match defined access mode"):
169-
Backend(ControllerAttrWrongAccessMode(), loop)
168+
FastCS(ControllerAttrWrongAccessMode(), [], loop)
170169

171170
class ControllerUnspecifiedAccessMode(Controller):
172171
unspecified_access_mode: Attribute
173172

174173
async def initialise(self):
175174
self.unspecified_access_mode = AttrRW(Int())
176175

177-
Backend(ControllerUnspecifiedAccessMode(), loop)
176+
FastCS(ControllerUnspecifiedAccessMode(), [], loop)

0 commit comments

Comments
 (0)