diff --git a/src/nti/externalization/tests/test_datastructures.py b/src/nti/externalization/tests/test_datastructures.py index 40f2a4f..524269b 100644 --- a/src/nti/externalization/tests/test_datastructures.py +++ b/src/nti/externalization/tests/test_datastructures.py @@ -770,6 +770,7 @@ def test_provides(self): def test_subclass(self): from nti.externalization.interfaces import IInternalObjectExternalizer from nti.externalization.datastructures import StandardInternalObjectExternalizer + from nti.externalization._compat import PURE_PYTHON class X(StandardInternalObjectExternalizer): def __init__(self, context): @@ -791,10 +792,13 @@ class Ext(object): # Now non-native-strs ext = Ext() ext.creator = u'sjohnson' - with self.assertRaises(TypeError): - o.__external_class_name__ = u'Foo' if bytes is str else b'Foo' o.context = ext + if not PURE_PYTHON: + # XXX: pure-python mode allows anything. + with self.assertRaises(TypeError): + o.__external_class_name__ = u'Foo' if bytes is str else b'Foo' + ext = o.toExternalObject() assert_that(ext, is_({ 'Class': 'Foo',