def testBinaryNoneAndUid(self): """Test with a binary plist. Note this test data includes a "null" value, which we translate into "None" in Python. Note also that expected isTrue is None in plist_dict. This is intentional. In the process of creating test data for this unit test with OSX defaults(1), I used a boolean data container for "isNone", set it to True, and then hexedited it to becoming a null value. (See the structure relationship in _BinLoadSimple to see why). Unfortunately defaults had tried to save space and assigned isTrue and isNone to the same value container, so isTrue also became None when I did this. For the purposes of the test I left everything that way instead of fighting defaults. """ plist_bin = base64.b64decode(""" YnBsaXN0MDDaAQIDBAUGBwgJCgsMDQ4PEAwSExdTaXM5VmlzVHJ1ZVVpc1VpZFRpc1BpVmlzRGF0 YVdpc0ZhbHNlVmlzTm9uZVNmb29XaXNBcnJheVdpc1RvZGF5EAkAgTA5I0AJHrhgAAAARAECA/8I CVNiYXKjFBUWUTFRMlEzM0G0a0uAAAAACB0hKC4zOkJJTVVdX2BjbHFyc3d7fX+BAAAAAAAAAQEA AAAAAAAAGAAAAAAAAAAAAAAAAAAAAIo=""") plist_dict = { 'foo': 'bar', 'is9': 9, 'isUid': plist.AppleUid(12345), 'isArray': ['1', '2', '3'], 'isData': plist.AppleData('\x01\x02\x03\xff'), 'isFalse': False, 'isTrue': None, # see docstring 'isPi': 3.1400001049041748, 'isToday': datetime.datetime(2011, 11, 10, 0, 0, tzinfo=plist.UTC()), 'isNone': None, # see docstring } self.PlistTest(plist_bin, plist_dict)
def testBinary(self): """Test with a binary plist.""" plist_bin = base64.b64decode(""" YnBsaXN0MDDYAQIDBAUGBwgJCgsMDQ4PEFNpczlWaXNUcnVlVGlzUGlXaXNGYWxzZVZpc0RhdGFT Zm9vV2lzVG9kYXlXaXNBcnJheRAJCSJASPXDCEQBAgP/U2JhcjNBtGtLgAAAAKMREhNRMVEyUTMI GR0kKTE4PERMTk9UVVpeZ2ttbwAAAAAAAAEBAAAAAAAAABQAAAAAAAAAAAAAAAAAAABx""") plist_dict = { 'foo': 'bar', 'is9': 9, 'isArray': ['1', '2', '3'], 'isData': plist.AppleData('\x01\x02\x03\xff'), 'isFalse': False, 'isTrue': True, 'isPi': 3.1400001049041748, 'isToday': datetime.datetime(2011, 11, 10, 0, 0, tzinfo=plist.UTC()), } self.PlistTest(plist_bin, plist_dict)