<s> from conary_test import rephelp <EOL> from conary . lib import ar <EOL> class ArTest ( rephelp . RepositoryHelper ) : <EOL> def getArchiveFile ( self , path ) : <EOL> return file ( '<STR_LIT>' % ( self . sourceSearchDir , path ) ) <EOL> def testDeb ( self ) : <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ x . name for x in a ] <EOL> self . assertEquals ( b , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ x . name for x in a ] <EOL> self . assertEquals ( b , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> c = [ x for x in a ] <EOL> b = [ x . name for x in c ] <EOL> self . assertEquals ( b , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> magic = [ x . data . read ( ) for x in c if x . name == '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> self . assertEquals ( magic , '<STR_LIT>' ) <EOL> def testArchiveRepr ( self ) : <EOL> timestamp = <NUM_LIT> <EOL> import time <EOL> timestr = time . ctime ( timestamp ) <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ repr ( x ) for x in a ] <EOL> self . assertEquals ( b , [ <EOL> '<STR_LIT>' % timestr , <EOL> '<STR_LIT>' % timestr , <EOL> '<STR_LIT>' % timestr ] ) <EOL> def testGNUArchiveLongNames ( self ) : <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ x . name for x in a ] <EOL> self . assertEquals ( b , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ x . name for x in a ] <EOL> self . assertEquals ( b , [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def testGNUArchiveSymbolTable ( self ) : <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> b = [ x . name for x in a ] <EOL> self . assertEquals ( b , [ '<STR_LIT:/>' , '<STR_LIT>' ] ) <EOL> def testNotAnArArchive ( self ) : <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> def parseArchive ( ) : <EOL> b = [ x . name for x in a ] <EOL> self . assertRaises ( ar . ArchiveError , parseArchive ) <EOL> def testTruncatedArchive ( self ) : <EOL> a = ar . Archive ( self . getArchiveFile ( '<STR_LIT>' ) ) <EOL> def parseArchive ( ) : <EOL> b = [ x . name for x in a ] <EOL> self . assertRaises ( ar . ArchiveError , parseArchive ) </s>
