From e96ebb14dc4ff804db0e6a64b07f29cb88a720d5 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/io/test_saferepr.py b/testing/io/test_saferepr.py index 19df24738..e330dd9af 100644 --- a/testing/io/test_saferepr.py +++ b/testing/io/test_saferepr.py @@ -5,6 +5,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(): @@ -206,7 +207,9 @@ class TestSafereprUnbounded: def test_saferepr_unbounded(self): """saferepr() of an unbound method should still show the full information""" obj = self.Help() - obj_id = f"{id(obj) :x}".lstrip("0").lower() + # On windows, id adds leading zeros + obj_id = re.sub(r"^0+", "", f"{id(obj):x}").lower() + assert ( saferepr(obj) == f""