Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for Python 4 #173

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/codec/ber/test_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,17 @@ def testShortEncoding(self):
if sys.version_info[0:2] > (2, 5):
class UniversalStringDecoderTestCase(BaseTestCase):
def testDecoder(self):
assert decoder.decode(ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99))) == (char.UniversalString(sys.version_info[0] == 3 and 'abc' or unicode('abc')), null)
assert decoder.decode(ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99))) == (char.UniversalString(sys.version_info[0] >= 3 and 'abc' or unicode('abc')), null)


class BMPStringDecoderTestCase(BaseTestCase):
def testDecoder(self):
assert decoder.decode(ints2octs((30, 6, 0, 97, 0, 98, 0, 99))) == (char.BMPString(sys.version_info[0] == 3 and 'abc' or unicode('abc')), null)
assert decoder.decode(ints2octs((30, 6, 0, 97, 0, 98, 0, 99))) == (char.BMPString(sys.version_info[0] >= 3 and 'abc' or unicode('abc')), null)


class UTF8StringDecoderTestCase(BaseTestCase):
def testDecoder(self):
assert decoder.decode(ints2octs((12, 3, 97, 98, 99))) == (char.UTF8String(sys.version_info[0] == 3 and 'abc' or unicode('abc')), null)
assert decoder.decode(ints2octs((12, 3, 97, 98, 99))) == (char.UTF8String(sys.version_info[0] >= 3 and 'abc' or unicode('abc')), null)


class SequenceOfDecoderTestCase(BaseTestCase):
Expand Down
12 changes: 6 additions & 6 deletions tests/codec/ber/test_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,40 +436,40 @@ def testChar(self):
if sys.version_info[0:2] > (2, 5):
class UniversalStringEncoderTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(char.UniversalString(sys.version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs(
assert encoder.encode(char.UniversalString(sys.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 UniversalStringEncoderWithSchemaTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(
sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.UniversalString()
sys.version_info[0] >= 3 and 'abc' or unicode('abc'), asn1Spec=char.UniversalString()
) == ints2octs((28, 12, 0, 0, 0, 97, 0, 0, 0, 98, 0, 0, 0, 99)), 'Incorrect encoding'


class BMPStringEncoderTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(char.BMPString(sys.version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs(
assert encoder.encode(char.BMPString(sys.version_info[0] >= 3 and 'abc' or unicode('abc'))) == ints2octs(
(30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding'


class BMPStringEncoderWithSchemaTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(
sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.BMPString()
sys.version_info[0] >= 3 and 'abc' or unicode('abc'), asn1Spec=char.BMPString()
) == ints2octs((30, 6, 0, 97, 0, 98, 0, 99)), 'Incorrect encoding'


class UTF8StringEncoderTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(char.UTF8String(sys.version_info[0] == 3 and 'abc' or unicode('abc'))) == ints2octs(
assert encoder.encode(char.UTF8String(sys.version_info[0] >= 3 and 'abc' or unicode('abc'))) == ints2octs(
(12, 3, 97, 98, 99)), 'Incorrect encoding'


class UTF8StringEncoderWithSchemaTestCase(BaseTestCase):
def testEncoding(self):
assert encoder.encode(
sys.version_info[0] == 3 and 'abc' or unicode('abc'), asn1Spec=char.UTF8String()
sys.version_info[0] >= 3 and 'abc' or unicode('abc'), asn1Spec=char.UTF8String()
) == ints2octs((12, 3, 97, 98, 99)), 'Incorrect encoding'


Expand Down