Esempio n. 1
0
 def test_dict(self):
     val = {'foo': 1, aem.AEType(b'foob'): 2, aem.AEProp(b'barr'): 3}
     expectedVal = {
         'foo': 1,
         aem.AEType(b'foob'): 2,
         aem.AEType(b'barr'): 3
     }  # note that four-char-code keys are always unpacked as AEType
     d = self.c.pack(val)
     self.assertEqual(expectedVal, self.c.unpack(d))
Esempio n. 2
0
 def test_dict(self):
     val = {
         'foo': 1,
         aem.AEType('foob'): 2,
         aem.AEProp('barr'): 3
     }  # TO DO: also need to test appscript codecs (in separate test) to check String, AEType and Keyword keys all pack and unpack correctly
     expectedVal = {
         'foo': 1,
         aem.AEType('foob'): 2,
         aem.AEType('barr'): 3
     }  # note that four-char-code keys are always unpacked as AEType
     d = self.c.pack(val)
     self.assertEqual(expectedVal, self.c.unpack(d))
Esempio n. 3
0
 def test_typewrappers(self):
     for val in [
             aem.AEType("docu"),
             aem.AEEnum('yes '),
             aem.AEProp('pnam'),
             aem.AEKey('ABCD'),
     ]:
         d = self.c.pack(val)
         val2 = self.c.unpack(d)
         self.assertEqual(val, val2)
         self.assertEqual(val2, val)
     self.assertRaises(TypeError, aem.AEType, 3)
     self.assertRaises(ValueError, aem.AEType, "docum")