forked from goodboy/tractor
Pass `str` dtype for `use_str` case
parent
f9a84f0732
commit
4f442efbd7
|
@ -70,7 +70,10 @@ async def child_read_shm_list(
|
|||
) -> None:
|
||||
|
||||
# attach in child
|
||||
shml = attach_shm_list(key=shm_key)
|
||||
shml = attach_shm_list(
|
||||
key=shm_key,
|
||||
# dtype=str if use_str else float,
|
||||
)
|
||||
await ctx.started(shml.key)
|
||||
|
||||
async with ctx.open_stream() as stream:
|
||||
|
@ -92,7 +95,9 @@ async def child_read_shm_list(
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'use_str', [False, True],
|
||||
'use_str',
|
||||
[False, True],
|
||||
ids=lambda i: f'use_str_values={i}',
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
'frame_size',
|
||||
|
@ -106,7 +111,7 @@ def test_parent_writer_child_reader(
|
|||
|
||||
async def main():
|
||||
async with tractor.open_nursery(
|
||||
debug_mode=True,
|
||||
# debug_mode=True,
|
||||
) as an:
|
||||
|
||||
portal = await an.start_actor(
|
||||
|
@ -121,6 +126,7 @@ def test_parent_writer_child_reader(
|
|||
shml = open_shm_list(
|
||||
key=key,
|
||||
size=seq_size,
|
||||
dtype=str if use_str else float,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
|
@ -143,7 +149,7 @@ def test_parent_writer_child_reader(
|
|||
if use_str:
|
||||
val = str(val)
|
||||
|
||||
print(f'(parent): writing {val}')
|
||||
# print(f'(parent): writing {val}')
|
||||
shml[i] = val
|
||||
|
||||
# only on frame fills do we
|
||||
|
|
|
@ -460,7 +460,6 @@ class ShmArray:
|
|||
|
||||
|
||||
def open_shm_ndarray(
|
||||
|
||||
key: Optional[str] = None,
|
||||
size: int = int(2 ** 10),
|
||||
dtype: np.dtype | None = None,
|
||||
|
@ -799,7 +798,6 @@ def open_shm_list(
|
|||
None: None,
|
||||
}[dtype]
|
||||
sequence = [default] * size
|
||||
# sequence = [0.] * size
|
||||
|
||||
shml = ShmList(
|
||||
sequence=sequence,
|
||||
|
|
Loading…
Reference in New Issue