summaryrefslogtreecommitdiff
path: root/tests/run/cpdef_enums_import.srctree
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/cpdef_enums_import.srctree')
-rw-r--r--tests/run/cpdef_enums_import.srctree13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/run/cpdef_enums_import.srctree b/tests/run/cpdef_enums_import.srctree
index 4cf0eb7e2..928a2d0b1 100644
--- a/tests/run/cpdef_enums_import.srctree
+++ b/tests/run/cpdef_enums_import.srctree
@@ -28,13 +28,23 @@ cpdef enum NamedEnumType:
cpdef foo()
+######## enums_without_pyx.pxd #####
+
+cpdef enum EnumTypeNotInPyx:
+ AnotherEnumValue = 500
+
######## no_enums.pyx ########
from enums cimport *
+from enums_without_pyx cimport *
def get_named_enum_value():
return NamedEnumType.NamedEnumValue
+def get_named_without_pyx():
+ # This'll generate a warning but return a c int
+ return EnumTypeNotInPyx.AnotherEnumValue
+
######## import_enums_test.py ########
# We can import enums with a star import.
@@ -51,3 +61,6 @@ assert 'FOO' not in dir(no_enums)
assert 'foo' not in dir(no_enums)
assert no_enums.get_named_enum_value() == NamedEnumType.NamedEnumValue
+# In this case the enum isn't accessible from Python (by design)
+# but the conversion to Python goes through a reasonable fallback
+assert no_enums.get_named_without_pyx() == 500