Skip to content

Commit

Permalink
refactored MeasureFormat enum
Browse files Browse the repository at this point in the history
  • Loading branch information
flexatone committed Sep 30, 2022
1 parent 6830bd2 commit 7353600
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion static_frame/core/memory_measure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import math
import typing as tp
from collections import abc
from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions static_frame/core/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
import datetime
import math
import operator
import os
import tempfile
Expand Down
22 changes: 11 additions & 11 deletions static_frame/test/unit/test_memory_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,22 @@ def test_measure_format_a(self) -> None:
ma1 = MaterializedArray(a1, format=MeasureFormat.LOCAL_MATERIALIZED_DATA)

self.assertEqual(getsizeof_total(mempty,
format=MeasureFormat.SHARED_MATERIALIZED_DATA),
format=MeasureFormat.REFERENCED_MATERIALIZED_DATA),
0)
self.assertEqual(getsizeof_total(empty,
format=MeasureFormat.SHARED_MATERIALIZED_DATA),
format=MeasureFormat.REFERENCED_MATERIALIZED_DATA),
0)

self.assertEqual(getsizeof_total(ma1,
format=MeasureFormat.SHARED_MATERIALIZED_DATA),
format=MeasureFormat.REFERENCED_MATERIALIZED_DATA),
a1.nbytes,
)
self.assertEqual(getsizeof_total(a1,
format=MeasureFormat.SHARED_MATERIALIZED_DATA),
format=MeasureFormat.REFERENCED_MATERIALIZED_DATA),
a1.nbytes,
)
self.assertEqual(getsizeof_total(a2,
format=MeasureFormat.SHARED_MATERIALIZED_DATA),
format=MeasureFormat.REFERENCED_MATERIALIZED_DATA),
a1.nbytes,
)

Expand All @@ -332,17 +332,17 @@ def test_measure_format_b(self) -> None:
a2 = a1[:]

self.assertEqual(getsizeof_total(empty,
format=MeasureFormat.SHARED_MATERIALIZED),
format=MeasureFormat.REFERENCED_MATERIALIZED),
getsizeof(None) + getsizeof(empty), # this is just the GC component
)

self.assertEqual(getsizeof_total(a1,
format=MeasureFormat.SHARED_MATERIALIZED),
format=MeasureFormat.REFERENCED_MATERIALIZED),
getsizeof(None) + getsizeof(empty) + a1.nbytes,
)

self.assertEqual(getsizeof_total(a2,
format=MeasureFormat.SHARED_MATERIALIZED),
format=MeasureFormat.REFERENCED_MATERIALIZED),
getsizeof(None) + getsizeof(empty) + a1.nbytes,
)

Expand Down Expand Up @@ -372,17 +372,17 @@ def test_measure_format_d(self) -> None:
a2 = a1[:]

self.assertEqual(getsizeof_total(empty,
format=MeasureFormat.SHARED),
format=MeasureFormat.REFERENCED),
getsizeof(empty),
)

self.assertEqual(getsizeof_total(a1,
format=MeasureFormat.SHARED),
format=MeasureFormat.REFERENCED),
getsizeof(a1),
)

self.assertEqual(getsizeof_total(a2,
format=MeasureFormat.SHARED),
format=MeasureFormat.REFERENCED),
getsizeof(a2) + getsizeof(a1),
)

Expand Down

0 comments on commit 7353600

Please sign in to comment.