From 609e62ca45f1ebca6c3b44dfefec615905f90fbf Mon Sep 17 00:00:00 2001 From: YiFei Zhu Date: Sat, 13 May 2023 03:28:13 -0400 Subject: [PATCH] test_Path.py: Fix path ordering when both sources are same size The paths are sorted in an unexpected way. Test both cases (though only one case happens per Python version), and document what is going on behind the test case. In Python 3.11 both the object and the list have the same size. The object grew by 8 bytes compared to Python 3.10. For #41 --- guppy/heapy/test/test_Path.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/guppy/heapy/test/test_Path.py b/guppy/heapy/test/test_Path.py index cf1a543..456c3e1 100644 --- a/guppy/heapy/test/test_Path.py +++ b/guppy/heapy/test/test_Path.py @@ -765,7 +765,11 @@ def str_address(x): return '
' b = list(it) self.aseq(str(a), str(b)) - self.aseq(o.getvalue(), """\ + # The sort order is based on the source set's byid partition (see + # Path.PathsIter.reset), which sorts based on the size, then render + # (see Part.IdentityPartition.__init__) + if sys.getsizeof(y) > sys.getsizeof(ob): + self.aseq(o.getvalue(), """\ 0: hpy().Root.i0_sysdict 0: Src.i0_modules['sys'].__dict__ 0: hpy().Root.i0_sysdict @@ -781,6 +785,23 @@ def str_address(x): return '
' 0: <1 list:
*1>[0] 1: <1 __main__.O:
>.x """.replace('__main__', self.__module__)) + else: + self.aseq(o.getvalue(), """\ + 0: hpy().Root.i0_sysdict + 0: Src.i0_modules['sys'].__dict__ + 0: hpy().Root.i0_sysdict + 0: hpy().Root.i0_sysdict + 0: Src[0][0][0] + 0: Src[0][0][0] + 0: Src[0] + 0: Src.x + 0: <1 list:
*1>[0] + 0: <1 list:
*1>[0] + 0: <1 __main__.O:
>.x + 1: <1 list:
*1>[0] + 0: <1 __main__.O:
>.x + 1: <1 list:
*1>[0] +""".replace('__main__', self.__module__)) def test_2(self): # To assist interactivity,