summaryrefslogtreecommitdiff
path: root/ext/pybind11/tests/test_constants_and_functions.py
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/tests/test_constants_and_functions.py')
-rw-r--r--ext/pybind11/tests/test_constants_and_functions.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/ext/pybind11/tests/test_constants_and_functions.py b/ext/pybind11/tests/test_constants_and_functions.py
index 2a570d2e5..472682d61 100644
--- a/ext/pybind11/tests/test_constants_and_functions.py
+++ b/ext/pybind11/tests/test_constants_and_functions.py
@@ -1,33 +1,29 @@
+from pybind11_tests import constants_and_functions as m
def test_constants():
- from pybind11_tests import some_constant
-
- assert some_constant == 14
+ assert m.some_constant == 14
def test_function_overloading():
- from pybind11_tests import MyEnum, test_function
-
- assert test_function() == "test_function()"
- assert test_function(7) == "test_function(7)"
- assert test_function(MyEnum.EFirstEntry) == "test_function(enum=1)"
- assert test_function(MyEnum.ESecondEntry) == "test_function(enum=2)"
+ assert m.test_function() == "test_function()"
+ assert m.test_function(7) == "test_function(7)"
+ assert m.test_function(m.MyEnum.EFirstEntry) == "test_function(enum=1)"
+ assert m.test_function(m.MyEnum.ESecondEntry) == "test_function(enum=2)"
- assert test_function(1, 1.0) == "test_function(int, float)"
- assert test_function(2.0, 2) == "test_function(float, int)"
+ assert m.test_function() == "test_function()"
+ assert m.test_function("abcd") == "test_function(char *)"
+ assert m.test_function(1, 1.0) == "test_function(int, float)"
+ assert m.test_function(1, 1.0) == "test_function(int, float)"
+ assert m.test_function(2.0, 2) == "test_function(float, int)"
def test_bytes():
- from pybind11_tests import return_bytes, print_bytes
-
- assert print_bytes(return_bytes()) == "bytes[1 0 2 0]"
+ assert m.print_bytes(m.return_bytes()) == "bytes[1 0 2 0]"
def test_exception_specifiers():
- from pybind11_tests.exc_sp import C, f1, f2, f3, f4
-
- c = C()
+ c = m.C()
assert c.m1(2) == 1
assert c.m2(3) == 1
assert c.m3(5) == 2
@@ -37,7 +33,7 @@ def test_exception_specifiers():
assert c.m7(20) == 13
assert c.m8(29) == 21
- assert f1(33) == 34
- assert f2(53) == 55
- assert f3(86) == 89
- assert f4(140) == 144
+ assert m.f1(33) == 34
+ assert m.f2(53) == 55
+ assert m.f3(86) == 89
+ assert m.f4(140) == 144