Skip to content

Commit

Permalink
update assert
Browse files Browse the repository at this point in the history
  • Loading branch information
CSY-ModelCloud committed Dec 3, 2024
1 parent 112cbef commit b97f012
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion device_smi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
):
self.memory_used = memory_used
self.memory_process = memory_process
self.utilization = utilization
self.utilization = max(0, utilization)

def __str__(self):
return str(self.__dict__)
Expand Down
15 changes: 9 additions & 6 deletions tests/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
dev = Device("gpu")
print(dev)

assert dev.type == "gpu"
assert dev.pcie
assert dev.gpu
assert dev.type == "gpu", f"wrong type: {dev.type}"
if dev.pcie:
assert dev.pcie.gen
assert dev.pcie.speed
assert dev.pcie.id
if dev.gpu:
assert dev.gpu.driver
assert dev.gpu.firmware
assert dev.model
assert dev.memory_total > 10
assert dev.vendor
assert dev.features
assert dev.memory_total > 10, f"wrong memory size: {dev.memory_total}"

0 comments on commit b97f012

Please sign in to comment.