<s> from pyasn1 . type import tag <EOL> from pyasn1 . error import PyAsn1Error <EOL> from sys import version_info <EOL> if version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] < ( <NUM_LIT:2> , <NUM_LIT:7> ) or version_info [ <NUM_LIT:0> : <NUM_LIT:2> ] in ( ( <NUM_LIT:3> , <NUM_LIT:0> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) ) : <EOL> try : <EOL> import unittest2 as unittest <EOL> except ImportError : <EOL> import unittest <EOL> else : <EOL> import unittest <EOL> class TagTestCaseBase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . t1 = tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:3> ) <EOL> self . t2 = tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:3> ) <EOL> class TagReprTestCase ( TagTestCaseBase ) : <EOL> def testRepr ( self ) : <EOL> assert eval ( repr ( self . t1 ) , { '<STR_LIT>' : tag . Tag } ) == self . t1 , '<STR_LIT>' <EOL> class TagCmpTestCase ( TagTestCaseBase ) : <EOL> def testCmp ( self ) : <EOL> assert self . t1 == self . t2 , '<STR_LIT>' <EOL> def testHash ( self ) : <EOL> assert hash ( self . t1 ) == hash ( self . t2 ) , '<STR_LIT>' <EOL> def testSequence ( self ) : <EOL> assert self . t1 [ <NUM_LIT:0> ] == self . t2 [ <NUM_LIT:0> ] and self . t1 [ <NUM_LIT:1> ] == self . t2 [ <NUM_LIT:1> ] and self . t1 [ <NUM_LIT:2> ] == self . t2 [ <NUM_LIT:2> ] , '<STR_LIT>' <EOL> class TagSetTestCaseBase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . ts1 = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) <EOL> ) <EOL> self . ts2 = tag . initTagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) <EOL> ) <EOL> class TagSetReprTestCase ( TagSetTestCaseBase ) : <EOL> def testRepr ( self ) : <EOL> assert eval ( repr ( self . ts1 ) , { '<STR_LIT>' : tag . TagSet , '<STR_LIT>' : tag . Tag } ) == self . ts1 , '<STR_LIT>' <EOL> class TagSetCmpTestCase ( TagSetTestCaseBase ) : <EOL> def testCmp ( self ) : <EOL> assert self . ts1 == self . ts2 , '<STR_LIT>' <EOL> def testHash ( self ) : <EOL> assert hash ( self . ts1 ) == hash ( self . ts2 ) , '<STR_LIT>' <EOL> def testLen ( self ) : <EOL> assert len ( self . ts1 ) == len ( self . ts2 ) , '<STR_LIT>' <EOL> class TaggingTestSuite ( TagSetTestCaseBase ) : <EOL> def testImplicitTag ( self ) : <EOL> t = self . ts1 . tagImplicitly ( <EOL> tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) <EOL> assert t == tag . TagSet ( <EOL> tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) , '<STR_LIT>' <EOL> def testExplicitTag ( self ) : <EOL> t = self . ts1 . tagExplicitly ( <EOL> tag . Tag ( tag . tagClassPrivate , tag . tagFormatSimple , <NUM_LIT:32> ) <EOL> ) <EOL> assert t == tag . TagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassPrivate , tag . tagFormatConstructed , <NUM_LIT:32> ) <EOL> ) , '<STR_LIT>' <EOL> class TagSetAddTestSuite ( TagSetTestCaseBase ) : <EOL> def testAdd ( self ) : <EOL> t = self . ts1 + tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT:2> ) <EOL> assert t == tag . TagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT:2> ) <EOL> ) , '<STR_LIT>' <EOL> def testRadd ( self ) : <EOL> t = tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT:2> ) + self . ts1 <EOL> assert t == tag . TagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassApplication , tag . tagFormatSimple , <NUM_LIT:2> ) , <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) <EOL> ) , '<STR_LIT>' <EOL> class SuperTagSetTestCase ( TagSetTestCaseBase ) : <EOL> def testSuperTagCheck1 ( self ) : <EOL> assert self . ts1 . isSuperTagSetOf ( <EOL> tag . TagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) <EOL> ) ) , '<STR_LIT>' <EOL> def testSuperTagCheck2 ( self ) : <EOL> assert not self . ts1 . isSuperTagSetOf ( <EOL> tag . TagSet ( <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT:12> ) , <EOL> tag . Tag ( tag . tagClassUniversal , tag . tagFormatSimple , <NUM_LIT> ) <EOL> ) ) , '<STR_LIT>' <EOL> def testSuperTagCheck3 ( self ) : <EOL> assert self . ts1 . isSuperTagSetOf ( <EOL> tag . TagSet ( ( ) , tag . Tag ( tag . tagClassUniversal , <EOL> tag . tagFormatSimple , <NUM_LIT:12> ) ) <EOL> ) , '<STR_LIT>' <EOL> if __name__ == '<STR_LIT:__main__>' : unittest . main ( ) </s>
