Skip to content

Commit

Permalink
Update mock for device arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
rsuderman committed Jan 2, 2025
1 parent ab238b4 commit d9b2461
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ def __repr__(self):
def mock_device_array():
"""Create mock device array with proper interface implementation"""


class MockMapping:
def __enter__(self):
return self

def __exit__(self, exc_type: object | None, exc_value: object | None, exc_tb: object | None):
pass

def fill(self, value: int):
pass

class MockDeviceArray:
def __init__(self):
self.shape = None
Expand All @@ -67,6 +78,15 @@ def view(self, *args):
def copy_from(self, src):
pass

def copy_to(self, dst):
pass

def for_transfer(self):
return MockDeviceArray()

def map(self, *, read: bool = False, write: bool = False, discard: bool = False):
return MockMapping()

return MockDeviceArray()


Expand Down

0 comments on commit d9b2461

Please sign in to comment.