From c1091be526e2768f73be81ff4262c158888ad190 Mon Sep 17 00:00:00 2001 From: Farbod Ahmadian Date: Thu, 20 Jun 2024 15:05:53 +0200 Subject: [PATCH] fixup! tests: add for bound method representation --- testing/io/test_saferepr.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/testing/io/test_saferepr.py b/testing/io/test_saferepr.py index 3af31824c..7dd56164a 100644 --- a/testing/io/test_saferepr.py +++ b/testing/io/test_saferepr.py @@ -6,6 +6,7 @@ from _pytest._io.saferepr import DEFAULT_REPR_MAX_SIZE from _pytest._io.saferepr import saferepr from _pytest._io.saferepr import saferepr_unlimited import pytest +import re def test_simple_repr(): @@ -207,13 +208,11 @@ class TestSafereprUnbounded: def test_saferepr_unbounded(self): """saferepr() of an unbound method should still show the full information""" obj = self.Help() - # On windows, id adds leading zeros - obj_id = re.sub(r"^0+", "", f"{id(obj):x}").lower() - - assert ( - saferepr(obj) - == f"" + # using id() to fetch memory address fails on different platforms + pattern = re.compile( + r"", ) + assert pattern.match(saferepr(obj)) assert ( saferepr(self.Help) == f""