From 1172e4c1444352bd25e5f450fefe20217e703547 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Sat, 14 Aug 2021 12:59:03 +0530 Subject: [PATCH] test: improve ref count test --- local-requirements.txt | 1 - tests/test_reference_count_async.py | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/local-requirements.txt b/local-requirements.txt index 0e7799835..42f1901d6 100644 --- a/local-requirements.txt +++ b/local-requirements.txt @@ -5,7 +5,6 @@ flake8==3.9.2 flaky==3.7.0 mypy==0.902 objgraph==3.5.0 -pandas==1.2.4 Pillow==8.2.0 pixelmatch==0.2.3 pre-commit==2.13.0 diff --git a/tests/test_reference_count_async.py b/tests/test_reference_count_async.py index 3e42cfd66..839f8125e 100644 --- a/tests/test_reference_count_async.py +++ b/tests/test_reference_count_async.py @@ -13,9 +13,9 @@ # limitations under the License. import gc +from collections import defaultdict import objgraph -import pandas as pd import pytest from playwright.async_api import async_playwright @@ -42,11 +42,13 @@ async def test_memory_objects() -> None: gc.collect() - df_dicts = pd.DataFrame() - df_dicts["dicts"] = objgraph.by_type("dict") - df_dicts["pw_types"] = df_dicts["dicts"].apply(lambda x: x.get("_type")) + pw_objects = defaultdict(int) + for o in objgraph.by_type("dict"): + name = o.get("_type") + if not name: + continue + pw_objects[name] += 1 - head = df_dicts["pw_types"].value_counts().head(20) - assert "Dialog" not in head.items() - assert "Request" not in head.items() - assert "Route" not in head.items() + assert "Dialog" not in pw_objects + assert "Request" not in pw_objects + assert "Route" not in pw_objects