Add unit test for Struct_mallinfo2.__str__()

This commit is contained in:
Ryan Dick 2023-10-03 14:24:52 -04:00
parent 763dcacfd3
commit 519b892f0c
2 changed files with 9 additions and 1 deletions

View File

@ -50,6 +50,7 @@ class Struct_mallinfo2(ctypes.Structure):
)
s += f"{'fordblks': <10}= {(self.fordblks/2**30):15.5f} # Space in free blocks (non-mmapped) (GB)\n"
s += f"{'keepcost': <10}= {(self.keepcost/2**30):15.5f} # Top-most, releasable space (GB)\n"
return s
class LibcUtil:

View File

@ -1,6 +1,6 @@
import pytest
from invokeai.backend.model_management.libc_util import LibcUtil
from invokeai.backend.model_management.libc_util import LibcUtil, Struct_mallinfo2
def test_libc_util_mallinfo2():
@ -14,3 +14,10 @@ def test_libc_util_mallinfo2():
info = libc.mallinfo2()
assert info.arena > 0
def test_struct_mallinfo2_to_str():
"""Smoke test of Struct_mallinfo2.__str__()."""
info = Struct_mallinfo2()
info_str = str(info)
print(info_str)