summaryrefslogtreecommitdiff
path: root/test/codec/ber/test_encoder.py
diff options
context:
space:
mode:
authorelie <elie>2015-04-26 13:41:00 +0000
committerelie <elie>2015-04-26 13:41:00 +0000
commit6490109a602c998098c41dd5d7fb01ae6c4e3871 (patch)
tree36f14169544e4e59d87376316ae0a554fc26ac92 /test/codec/ber/test_encoder.py
parentdd0989a290c264585c4a042b949fcbf666326b7c (diff)
downloadpyasn1-6490109a602c998098c41dd5d7fb01ae6c4e3871.tar.gz
compatibility fixes to Python versions support
Diffstat (limited to 'test/codec/ber/test_encoder.py')
-rw-r--r--test/codec/ber/test_encoder.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/codec/ber/test_encoder.py b/test/codec/ber/test_encoder.py
index d1441b1..cd064b6 100644
--- a/test/codec/ber/test_encoder.py
+++ b/test/codec/ber/test_encoder.py
@@ -293,18 +293,19 @@ class RealEncoderTestCase(unittest.TestCase):
def testZero(self):
assert encoder.encode(univ.Real(0)) == ints2octs((9, 0))
-
-class UniversalStringEncoderTestCase(unittest.TestCase):
- def testEncoding(self):
- assert encoder.encode(char.UniversalString(u'abc')) == ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99)), 'Incorrect encoding'
+
+if version_info[0:2] > (2, 5):
+ class UniversalStringEncoderTestCase(unittest.TestCase):
+ def testEncoding(self):
+ assert encoder.encode(char.UniversalString(version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99)), 'Incorrect encoding'
class BMPStringEncoderTestCase(unittest.TestCase):
def testEncoding(self):
- assert encoder.encode(char.BMPString(u'abc')) == ints2octs((30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding'
+ assert encoder.encode(char.BMPString(version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs((30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding'
class UTF8StringEncoderTestCase(unittest.TestCase):
def testEncoding(self):
- assert encoder.encode(char.UTF8String(u'abc')) == ints2octs((12, 3, 97, 98, 99)), 'Incorrect encoding'
+ assert encoder.encode(char.UTF8String(version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs((12, 3, 97, 98, 99)), 'Incorrect encoding'
class SequenceEncoderTestCase(unittest.TestCase):
def setUp(self):