issue250 unicode/str mixes in parametrization names and values now works
This commit is contained in:
parent
296f752cca
commit
d0e18ac63f
|
@ -1,6 +1,8 @@
|
||||||
Changes between 2.3.4 and 2.3.5dev
|
Changes between 2.3.4 and 2.3.5dev
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
- issue250 unicode/str mixes in parametrization names and values now works
|
||||||
|
|
||||||
- issue257, assertion-triggered compilation of source ending in a
|
- issue257, assertion-triggered compilation of source ending in a
|
||||||
comment line doesn't blow up in python2.5 (fixed through py>=1.4.13.dev6)
|
comment line doesn't blow up in python2.5 (fixed through py>=1.4.13.dev6)
|
||||||
|
|
||||||
|
|
|
@ -732,7 +732,7 @@ def idmaker(argnames, argvalues):
|
||||||
this_id = []
|
this_id = []
|
||||||
for nameindex, val in enumerate(valset):
|
for nameindex, val in enumerate(valset):
|
||||||
if not isinstance(val, (float, int, str)):
|
if not isinstance(val, (float, int, str)):
|
||||||
this_id.append(argnames[nameindex]+str(valindex))
|
this_id.append(str(argnames[nameindex])+str(valindex))
|
||||||
else:
|
else:
|
||||||
this_id.append(str(val))
|
this_id.append(str(val))
|
||||||
idlist.append("-".join(this_id))
|
idlist.append("-".join(this_id))
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
import pytest, py, sys
|
import pytest, py, sys
|
||||||
from _pytest import python as funcargs
|
from _pytest import python as funcargs
|
||||||
from _pytest.python import FixtureLookupError
|
from _pytest.python import FixtureLookupError
|
||||||
|
@ -106,6 +107,7 @@ class TestMetafunc:
|
||||||
assert metafunc._calls[2].id == "x1-a"
|
assert metafunc._calls[2].id == "x1-a"
|
||||||
assert metafunc._calls[3].id == "x1-b"
|
assert metafunc._calls[3].id == "x1-b"
|
||||||
|
|
||||||
|
@pytest.mark.issue250
|
||||||
def test_idmaker_autoname(self):
|
def test_idmaker_autoname(self):
|
||||||
from _pytest.python import idmaker
|
from _pytest.python import idmaker
|
||||||
result = idmaker(("a", "b"), [("string", 1.0),
|
result = idmaker(("a", "b"), [("string", 1.0),
|
||||||
|
@ -115,6 +117,9 @@ class TestMetafunc:
|
||||||
result = idmaker(("a", "b"), [(object(), 1.0),
|
result = idmaker(("a", "b"), [(object(), 1.0),
|
||||||
(object(), object())])
|
(object(), object())])
|
||||||
assert result == ["a0-1.0", "a1-b1"]
|
assert result == ["a0-1.0", "a1-b1"]
|
||||||
|
# unicode mixing, issue250
|
||||||
|
result = idmaker((u"a", "b"), [({}, '\xc3\xb4')])
|
||||||
|
assert result == ['a0-\xc3\xb4']
|
||||||
|
|
||||||
|
|
||||||
def test_addcall_and_parametrize(self):
|
def test_addcall_and_parametrize(self):
|
||||||
|
|
Loading…
Reference in New Issue