fixup! tests: add for bound method representation
This commit is contained in:
parent
3d4c80e0ab
commit
e96ebb14dc
|
@ -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
|
||||||
from _pytest._io.saferepr import saferepr_unlimited
|
from _pytest._io.saferepr import saferepr_unlimited
|
||||||
import pytest
|
import pytest
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
def test_simple_repr():
|
def test_simple_repr():
|
||||||
|
@ -206,7 +207,9 @@ class TestSafereprUnbounded:
|
||||||
def test_saferepr_unbounded(self):
|
def test_saferepr_unbounded(self):
|
||||||
"""saferepr() of an unbound method should still show the full information"""
|
"""saferepr() of an unbound method should still show the full information"""
|
||||||
obj = self.Help()
|
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 (
|
assert (
|
||||||
saferepr(obj)
|
saferepr(obj)
|
||||||
== f"<test_saferepr.{self.__class__.__name__}.Help object at 0x{obj_id !s}>"
|
== f"<test_saferepr.{self.__class__.__name__}.Help object at 0x{obj_id !s}>"
|
||||||
|
|
Loading…
Reference in New Issue