From: <lu...@us...> - 2010-06-09 15:14:54
|
Revision: 470 http://pyscard.svn.sourceforge.net/pyscard/?rev=470&view=rev Author: ludov Date: 2010-06-09 15:14:47 +0000 (Wed, 09 Jun 2010) Log Message: ----------- make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py Modified: trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py 2010-06-09 15:10:25 UTC (rev 469) +++ trunk/pyscard/src/smartcard/test/framework/testcase_ATR.py 2010-06-09 15:14:47 UTC (rev 470) @@ -52,15 +52,16 @@ def testcase_ATRconfig(self): # we have at list 2 readers (one is the simulator), e.g. # two potential ATRs - self.assert_( len(expectedATRs) > 1 ) + self.assert_(len(expectedATRs) > 1) # we have at least two non empty ATRs - count=0 + count = 0 for atr in expectedATRs: - if atr!=[]: - count+=1 - self.assert_( count>1 ) + if atr != []: + count += 1 + self.assert_(count > 1) + def suite(): suite1 = unittest.makeSuite(testcase_ATR) return unittest.TestSuite((suite1)) Modified: trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py 2010-06-09 15:10:25 UTC (rev 469) +++ trunk/pyscard/src/smartcard/test/framework/testcase_CAtr.py 2010-06-09 15:14:47 UTC (rev 470) @@ -32,84 +32,87 @@ # gemalto jython from smartcard.ATR import ATR + class testcase_CAtr(unittest.TestCase): """Test APDU class and utilities""" def testcase_ATR1(self): """Usimera Classic 2.""" - a = ATR([ 0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0, 0x73, - 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81, 0xCD, 0xB9 ] ) - historicalbytes = [ 0x80, 0x31, 0xA0, 0x73, 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81, 0xCD] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), 0xB9 ) - self.assert_( a.checksumOK ) - self.assert_( a.isT0Supported() ) - self.assert_( not a.isT1Supported() ) - self.assert_( a.isT15Supported() ) + a = ATR([0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0, 0x73, + 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81, 0xCD, 0xB9]) + historicalbytes = [0x80, 0x31, 0xA0, 0x73, 0xBE, 0x21, 0x13, 0x67, + 0x29, 0x02, 0x01, 0x01, 0x81, 0xCD] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), 0xB9) + self.assert_(a.checksumOK) + self.assert_(a.isT0Supported()) + self.assert_(not a.isT1Supported()) + self.assert_(a.isT15Supported()) def testcase_ATR2(self): """Palmera Protect V2.""" - a = ATR( [ 0x3B, 0x65, 0x00, 0x00, 0x9C, 0x02, 0x02, 0x01, 0x02 ] ) - historicalbytes = [ 0x9C, 0x02, 0x02, 0x01, 0x02 ] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), None ) - self.assert_( a.isT0Supported() ) - self.assert_( not a.isT1Supported() ) - self.assert_( not a.isT15Supported() ) + a = ATR([0x3B, 0x65, 0x00, 0x00, 0x9C, 0x02, 0x02, 0x01, 0x02]) + historicalbytes = [0x9C, 0x02, 0x02, 0x01, 0x02] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), None) + self.assert_(a.isT0Supported()) + self.assert_(not a.isT1Supported()) + self.assert_(not a.isT15Supported()) def testcase_ATR3(self): """Simera 3.13.""" - a = ATR( [ 0x3B, 0x16, 0x18, 0x20, 0x02, 0x01, 0x00, 0x80, 0x0D ] ) - historicalbytes = [ 0x20, 0x02, 0x01, 0x00, 0x80, 0x0D ] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), None ) - self.assert_( a.isT0Supported() ) - self.assert_( not a.isT1Supported() ) - self.assert_( not a.isT15Supported() ) + a = ATR([0x3B, 0x16, 0x18, 0x20, 0x02, 0x01, 0x00, 0x80, 0x0D]) + historicalbytes = [0x20, 0x02, 0x01, 0x00, 0x80, 0x0D] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), None) + self.assert_(a.isT0Supported()) + self.assert_(not a.isT1Supported()) + self.assert_(not a.isT15Supported()) def testcase_ATR4(self): """SIMRock'n Tree""" - a = ATR( [ 0x3B, 0x77, 0x94, 0x00, 0x00, 0x82, 0x30, 0x00, 0x13, 0x6C, 0x9F, 0x22] ) - historicalbytes = [ 0x82, 0x30, 0x00, 0x13, 0x6C, 0x9F, 0x22] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), None ) - self.assert_( a.isT0Supported() ) - self.assert_( not a.isT1Supported() ) - self.assert_( not a.isT15Supported() ) + a = ATR([0x3B, 0x77, 0x94, 0x00, 0x00, 0x82, 0x30, 0x00, 0x13, + 0x6C, 0x9F, 0x22]) + historicalbytes = [0x82, 0x30, 0x00, 0x13, 0x6C, 0x9F, 0x22] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), None) + self.assert_(a.isT0Supported()) + self.assert_(not a.isT1Supported()) + self.assert_(not a.isT15Supported()) def testcase_ATR5(self): """Demo Vitale online IGEA340""" - a = ATR( [ 0x3F, 0x65, 0x25, 0x00, 0x52, 0x09, 0x6A, 0x90, 0x00] ) - historicalbytes = [ 0x52, 0x09, 0x6A, 0x90, 0x00] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), None ) - self.assert_( a.isT0Supported() ) - self.assert_( not a.isT1Supported() ) - self.assert_( not a.isT15Supported() ) + a = ATR([0x3F, 0x65, 0x25, 0x00, 0x52, 0x09, 0x6A, 0x90, 0x00]) + historicalbytes = [0x52, 0x09, 0x6A, 0x90, 0x00] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), None) + self.assert_(a.isT0Supported()) + self.assert_(not a.isT1Supported()) + self.assert_(not a.isT15Supported()) def testcase_ATR6(self): """Simagine 2002""" - a = ATR( [ 0x3B, 0x16, 0x94, 0x20, 0x02, 0x01, 0x00, 0x00, 0x0D ] ) - historicalbytes = [ 0x20, 0x02, 0x01, 0x00, 0x00, 0x0D ] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), None ) + a = ATR([0x3B, 0x16, 0x94, 0x20, 0x02, 0x01, 0x00, 0x00, 0x0D]) + historicalbytes = [0x20, 0x02, 0x01, 0x00, 0x00, 0x0D] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), None) - def testcase_ATR7(self): """Protect V3 T=1""" - a = ATR( [ 0x3B, 0xE5, 0x00, 0x00, 0x81, 0x21, 0x45, 0x9C, 0x10, 0x01, 0x00, 0x80, 0x0D ] ) - historicalbytes = [ 0x9C, 0x10, 0x01, 0x00, 0x80 ] - self.assertEquals( a.getHistoricalBytes(), historicalbytes ) - self.assertEquals( a.getChecksum(), 0x0D ) - self.assert_( not a.isT0Supported() ) - self.assert_( a.isT1Supported() ) - self.assert_( not a.isT15Supported() ) - self.assert_( a.checksumOK ) - self.assert_( a.getTB1()==0x00 ) - self.assert_( a.getTC1()==0x00 ) - self.assert_( a.getTD1()==0x81 ) - self.assert_( a.TD[2-1]==0x21 ) # TD2 - self.assert_( a.TB[3-1]==0x45 ) # TB3 + a = ATR([0x3B, 0xE5, 0x00, 0x00, 0x81, 0x21, 0x45, 0x9C, 0x10, + 0x01, 0x00, 0x80, 0x0D]) + historicalbytes = [0x9C, 0x10, 0x01, 0x00, 0x80] + self.assertEquals(a.getHistoricalBytes(), historicalbytes) + self.assertEquals(a.getChecksum(), 0x0D) + self.assert_(not a.isT0Supported()) + self.assert_(a.isT1Supported()) + self.assert_(not a.isT15Supported()) + self.assert_(a.checksumOK) + self.assert_(a.getTB1() == 0x00) + self.assert_(a.getTC1() == 0x00) + self.assert_(a.getTD1() == 0x81) + self.assert_(a.TD[2 - 1] == 0x21) # TD2 + self.assert_(a.TB[3 - 1] == 0x45) # TB3 def suite(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |