summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tracemalloc.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-01 03:07:02 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-01 03:07:02 (GMT)
commit524be3056e29a86741ba355c759ff304adf6cc3c (patch)
tree45f10ab8b321ffbda59da8cc2ceeb0aeeeaeee72 /Lib/test/test_tracemalloc.py
parent8f74a73ecb48773e545efd62fb1d058c98ae6e66 (diff)
downloadcpython-524be3056e29a86741ba355c759ff304adf6cc3c.zip
cpython-524be3056e29a86741ba355c759ff304adf6cc3c.tar.gz
cpython-524be3056e29a86741ba355c759ff304adf6cc3c.tar.bz2
tracemalloc: Fix slicing traces and fix slicing a traceback.
Diffstat (limited to 'Lib/test/test_tracemalloc.py')
-rw-r--r--Lib/test/test_tracemalloc.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index 484e313..3d2333f 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -123,7 +123,6 @@ class TestTracemallocEnabled(unittest.TestCase):
self.assertEqual(len(traceback), 1)
self.assertEqual(traceback, obj_traceback)
-
def find_trace(self, traces, traceback):
for trace in traces:
if trace[1] == traceback._frames:
@@ -147,7 +146,6 @@ class TestTracemallocEnabled(unittest.TestCase):
tracemalloc.stop()
self.assertEqual(tracemalloc._get_traces(), [])
-
def test_get_traces_intern_traceback(self):
# dummy wrappers to get more useful and identical frames in the traceback
def allocate_bytes2(size):
@@ -503,6 +501,14 @@ class TestSnapshot(unittest.TestCase):
self.assertEqual(str(stat),
'a.py:5: size=5002 B (+5000 B), count=2 (+1), average=2501 B')
+ def test_slices(self):
+ snapshot, snapshot2 = create_snapshots()
+ self.assertEqual(snapshot.traces[:2],
+ (snapshot.traces[0], snapshot.traces[1]))
+
+ traceback = snapshot.traces[0].traceback
+ self.assertEqual(traceback[:2],
+ (traceback[0], traceback[1]))
class TestFilters(unittest.TestCase):