Skip to content

Commit 3bc9bc4

Browse files
author
James Souter
committed
fixes after rebase
1 parent a1657db commit 3bc9bc4

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
@@ -50,7 +50,7 @@ def validate_hinted_attributes(controller: BaseController):
5050
attr_dtype = None
5151
else:
5252
attr_class = get_origin(hint)
53-
(attr_dtype,) = get_args(hint)
53+
attr_dtype = get_args(hint)[0]
5454
if not issubclass(attr_class, Attribute):
5555
continue
5656

tests/test_util.py

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

88
from fastcs.attributes import Attribute, AttrR, AttrRW
9-
from fastcs.backend import Backend
109
from fastcs.controller import Controller
1110
from fastcs.datatypes import Bool, Enum, Float, Int, String
1211
from fastcs.util import (
@@ -145,13 +144,13 @@ async def initialise(self):
145144
self.hinted = AttrR(Int())
146145

147146
# no assertion thrown
148-
Backend(ControllerUnspecifiedAccessMode(), loop)
147+
FastCS(ControllerUnspecifiedAccessMode(), [], loop)
149148

150149

151150
def test_hinted_attributes_verified_on_subcontrollers():
152151
loop = asyncio.get_event_loop()
153152

154-
class ControllerWithWrongType(SubController):
153+
class ControllerWithWrongType(Controller):
155154
hinted_missing: AttrR[int]
156155

157156
async def connect(self):
@@ -163,7 +162,7 @@ async def initialise(self):
163162
self.register_sub_controller("MySubController", subcontroller)
164163

165164
with pytest.raises(RuntimeError, match="failed to introspect hinted attribute"):
166-
Backend(TopController(), loop)
165+
FastCS(TopController(), [], loop)
167166

168167

169168
def test_hinted_attribute_types_verified():
@@ -177,12 +176,12 @@ async def initialise(self):
177176
self.read_attr = AttrRW(Int())
178177

179178
with pytest.raises(RuntimeError, match="does not match defined access mode"):
180-
Backend(ControllerAttrWrongAccessMode(), loop)
179+
FastCS(ControllerAttrWrongAccessMode(), [], loop)
181180

182181
class ControllerUnspecifiedAccessMode(Controller):
183182
unspecified_access_mode: Attribute
184183

185184
async def initialise(self):
186185
self.unspecified_access_mode = AttrRW(Int())
187186

188-
Backend(ControllerUnspecifiedAccessMode(), loop)
187+
FastCS(ControllerUnspecifiedAccessMode(), [], loop)

0 commit comments

Comments
 (0)