X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/2a3f4da1c95d71e6045ddf1617754bacddfd46c3..e5c26109231763a2464a8f8076e7b633996b5d5c:/t/t-bytes.py diff --git a/t/t-bytes.py b/t/t-bytes.py index 36a3f9f..27b7e49 100644 --- a/t/t-bytes.py +++ b/t/t-bytes.py @@ -47,10 +47,16 @@ class TestByteString (U.TestCase): x = C.ByteString(T.bin("once upon a time there was a string")) - ## Check that simple indexing works. - me.assertEqual(type(x[3]), C.ByteString) - me.assertEqual(x[3], 'e') - me.assertEqual(x[-5], 't') + ## Check that simple indexing works. Alas the behaviour differs between + ## Python major versions. + if T.PY3: + me.assertEqual(type(x[3]), int) + me.assertEqual(x[3], 101) + me.assertEqual(x[-5], 116) + else: + me.assertEqual(type(x[3]), C.ByteString) + me.assertEqual(x[3], 'e') + me.assertEqual(x[-5], 't') ## Check out-of-range detection. x[34]; me.assertRaises(IndexError, lambda: x[35])