We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 591f0c7 commit 0a79c69Copy full SHA for 0a79c69
cuda_core/tests/test_graphics.py
@@ -318,6 +318,16 @@ def test_resource_context_manager_can_map_inside_scope(self):
318
assert isinstance(buf, Buffer)
319
assert buf.handle != 0
320
321
+ def test_chained_map_context_manager_unmaps(self):
322
+ with _gl_context_and_buffer(nbytes=4096) as (gl_buf, _):
323
+ stream = _create_stream()
324
+ with GraphicsResource.from_gl_buffer(gl_buf, flags="write_discard").map(stream=stream) as buf:
325
+ assert isinstance(buf, Buffer)
326
+ assert buf.handle != 0
327
+ assert buf.size > 0
328
+ assert buf.handle == 0
329
+ assert buf.size == 0
330
+
331
def test_map_with_stream(self):
332
with _gl_context_and_buffer(nbytes=4096) as (gl_buf, nbytes):
333
stream = _create_stream()
0 commit comments