Generate useful parameterization IDs for complex() numbers.
This commit is contained in:
parent
5165bf97c6
commit
5c04674e96
1
AUTHORS
1
AUTHORS
|
@ -125,6 +125,7 @@ Gene Wood
|
|||
George Kussumoto
|
||||
Georgy Dyuldin
|
||||
Gleb Nikonorov
|
||||
Graeme Smecher
|
||||
Graham Horler
|
||||
Greg Price
|
||||
Gregory Lee
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Complex numbers are now treated like floats and integers when generating parameterization IDs.
|
|
@ -1334,7 +1334,7 @@ def _idval(
|
|||
|
||||
if isinstance(val, STRING_TYPES):
|
||||
return _ascii_escaped_by_config(val, config)
|
||||
elif val is None or isinstance(val, (float, int, bool)):
|
||||
elif val is None or isinstance(val, (float, int, bool, complex)):
|
||||
return str(val)
|
||||
elif isinstance(val, REGEX_TYPE):
|
||||
return ascii_escaped(val.pattern)
|
||||
|
|
|
@ -403,6 +403,7 @@ class TestMetafunc:
|
|||
pytest.param(tuple("eight"), (8, -8, 8)),
|
||||
pytest.param(b"\xc3\xb4", b"name"),
|
||||
pytest.param(b"\xc3\xb4", "other"),
|
||||
pytest.param(1.0j, -2.0j),
|
||||
],
|
||||
)
|
||||
assert result == [
|
||||
|
@ -418,6 +419,7 @@ class TestMetafunc:
|
|||
"a9-b9",
|
||||
"\\xc3\\xb4-name",
|
||||
"\\xc3\\xb4-other",
|
||||
"1j-(-0-2j)",
|
||||
]
|
||||
|
||||
def test_idmaker_non_printable_characters(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue