diff options
-rw-r--r-- | tests/test_gi.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py index 200c15c..41a12e2 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -14,8 +14,30 @@ sys.path.insert(0, "../") from gi.repository import GIMarshallingTests +# CONSTANT_UTF8 is a constant value from inside GIMarshallingTests, containing +# bytes representing a UTF-8 encoded string. +# +# We will try and invoke entry points in GIMarshallingTests, passing a string. +# The entry points assert that the string they receive is the same value, thus +# verifying that marshalling of string values is working. +# +# The string is defined in gobject-introspection/gir/gimarshallingtests.h +# where it has value "const \xe2\x99\xa5 utf8" +# i.e. +# "const " + U+2665 BLACK HEART SUIT + " utf8" +# as U+2665 BLACK HEART SUIT: 0xE2 0x99 0xA5 in UTF8 +# +try: + _u = unicode + + # For Python 2, we express it as a UTF8-encoded string literal: + CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8" + +except NameError: + # For Python 3, we express it as a (unicode) string: + CONSTANT_UTF8 = "const " + chr(0x2665) + " utf8" + -CONSTANT_UTF8 = "const \xe2\x99\xa5 utf8" CONSTANT_NUMBER = 42 |