@@ -177,10 +177,14 @@ def test_object_identifier(self):
177177 def test_long_object_identifier (self ):
178178 enc = asn1 .Encoder ()
179179 enc .start ()
180- enc .write ('39.2 .3' , asn1 .Numbers .ObjectIdentifier )
180+ enc .write ('2.1482 .3' , asn1 .Numbers .ObjectIdentifier )
181181 res = enc .output ()
182182 assert res == b'\x06 \x03 \x8c \x1a \x03 '
183183 enc .start ()
184+ enc .write ('2.999.3' , asn1 .Numbers .ObjectIdentifier )
185+ res = enc .output ()
186+ assert res == b'\x06 \x03 \x88 \x37 \x03 '
187+ enc .start ()
184188 enc .write ('1.39.3' , asn1 .Numbers .ObjectIdentifier )
185189 res = enc .output ()
186190 assert res == b'\x06 \x02 \x4f \x03 '
@@ -341,7 +345,7 @@ def test_error_object_identifier(self):
341345 enc = asn1 .Encoder ()
342346 enc .start ()
343347 pytest .raises (asn1 .Error , enc .write , '1' , asn1 .Numbers .ObjectIdentifier )
344- pytest .raises (asn1 .Error , enc .write , '40 .2.3' , asn1 .Numbers .ObjectIdentifier )
348+ pytest .raises (asn1 .Error , enc .write , '3 .2.3' , asn1 .Numbers .ObjectIdentifier )
345349 pytest .raises (asn1 .Error , enc .write , '1.40.3' , asn1 .Numbers .ObjectIdentifier )
346350 pytest .raises (asn1 .Error , enc .write , '1.2.3.' , asn1 .Numbers .ObjectIdentifier )
347351 pytest .raises (asn1 .Error , enc .write , '.1.2.3' , asn1 .Numbers .ObjectIdentifier )
@@ -521,7 +525,11 @@ def test_long_object_identifier(self):
521525 buf = b'\x06 \x03 \x8c \x1a \x03 '
522526 dec .start (buf )
523527 tag , val = dec .read ()
524- assert val == u'39.2.3'
528+ assert val == u'2.1482.3'
529+ buf = b'\x06 \x03 \x88 \x37 \x03 '
530+ dec .start (buf )
531+ tag , val = dec .read ()
532+ assert val == u'2.999.3'
525533 buf = b'\x06 \x02 \x4f \x03 '
526534 dec .start (buf )
527535 tag , val = dec .read ()
@@ -745,13 +753,7 @@ def test_error_non_normalized_negative_integer(self):
745753 pytest .raises (asn1 .Error , dec .read )
746754
747755 def test_error_non_normalised_object_identifier (self ):
748- buf = b'\x06 \x02 \x80 \x01 '
749- dec = asn1 .Decoder ()
750- dec .start (buf )
751- pytest .raises (asn1 .Error , dec .read )
752-
753- def test_error_object_identifier_with_too_large_first_component (self ):
754- buf = b'\x06 \x02 \x8c \x40 '
756+ buf = b'\x06 \x02 \x01 \x80 '
755757 dec = asn1 .Decoder ()
756758 dec .start (buf )
757759 pytest .raises (asn1 .Error , dec .read )
@@ -1079,12 +1081,22 @@ def test_octet_string(self):
10791081 def test_null (self ):
10801082 TestEncoderDecoder .assert_encode_decode (None , asn1 .Numbers .Null )
10811083
1082- def test_object_identifier (self ):
1084+ def test_real_object_identifier (self ):
10831085 TestEncoderDecoder .assert_encode_decode (
10841086 '1.2.840.113554.1.2.1.1' ,
10851087 asn1 .Numbers .ObjectIdentifier
10861088 )
10871089
1090+ def test_long_object_identifier (self ):
1091+ for v in \
1092+ (
1093+ '2.60.3' ,
1094+ '2.999.3' ,
1095+ '1.39.3' ,
1096+ '1.2.300000'
1097+ ):
1098+ TestEncoderDecoder .assert_encode_decode (v , asn1 .Numbers .ObjectIdentifier )
1099+
10881100 def test_enumerated (self ):
10891101 for v in (1 , 2 , 42 ):
10901102 TestEncoderDecoder .assert_encode_decode (v , asn1 .Numbers .Enumerated )
0 commit comments