mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Add make_simple_namespace function and tests (#2840)
Co-authored-by: Jouke Witteveen <j.witteveen@cosine.nl>
This commit is contained in:
@@ -99,6 +99,19 @@ def test_dict(capture, doc):
|
||||
assert m.dict_keyword_constructor() == {"x": 1, "y": 2, "z": 3}
|
||||
|
||||
|
||||
def test_tuple():
|
||||
assert m.get_tuple() == (42, None, "spam")
|
||||
|
||||
|
||||
@pytest.mark.skipif("env.PY2")
|
||||
def test_simple_namespace():
|
||||
ns = m.get_simple_namespace()
|
||||
assert ns.attr == 42
|
||||
assert ns.x == "foo"
|
||||
assert ns.right == 2
|
||||
assert not hasattr(ns, "wrong")
|
||||
|
||||
|
||||
def test_str(doc):
|
||||
assert m.str_from_string().encode().decode() == "baz"
|
||||
assert m.str_from_bytes().encode().decode() == "boo"
|
||||
|
||||
Reference in New Issue
Block a user