Esempio n. 1
0
 def testOctetValueParsing(self):
     self.assertEqual(len(self.dict['Test-Octets'].values), 0)
     self.dict.ReadDictionary(
         StringIO('ATTRIBUTE Test-Octets 1 octets\n'
                  'VALUE Test-Octets Value-A 65\n'  # "A"
                  'VALUE Test-Octets Value-B 0x42\n'))  # "B"
     self.assertEqual(len(self.dict['Test-Octets'].values), 2)
     self.assertEqual(
         DecodeAttr('octets', self.dict['Test-Octets'].values['Value-A']),
         b'A')
     self.assertEqual(
         DecodeAttr('octets', self.dict['Test-Octets'].values['Value-B']),
         b'B')
Esempio n. 2
0
 def testInteger64ValueParsing(self):
     self.assertEqual(len(self.dict['Test-Integer64'].values), 0)
     self.dict.ReadDictionary(StringIO('VALUE Test-Integer64 Value-Six 5'))
     self.assertEqual(len(self.dict['Test-Integer64'].values), 1)
     self.assertEqual(
         DecodeAttr('integer64',
                    self.dict['Test-Integer64'].values['Value-Six']), 5)
Esempio n. 3
0
 def testStringValueParsing(self):
     self.assertEqual(len(self.dict['Test-String'].values), 0)
     self.dict.ReadDictionary(
         StringIO('VALUE Test-String Value-Custard custardpie'))
     self.assertEqual(len(self.dict['Test-String'].values), 1)
     self.assertEqual(
         DecodeAttr('string',
                    self.dict['Test-String'].values['Value-Custard']),
         'custardpie')