Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testGetComment(self):
key = PBXKey("123", None)
key._get_comment = lambda: "comment"
self.assertEqual(key.__repr__(), "123 /* comment */")
def testGetItem(self):
obj = {"a": "varA", "b": [1, 2, 3], "c": {"c1": "FDDF6A571C68E5B100D7A645"}}
dobj = PBXGenericObject().parse(obj)
self.assertIsInstance(dobj["c"]["c1"], PBXKey)
self.assertIsNone(dobj['X'])
def testParseKey(self):
obj = "FDDF6A571C68E5B100D7A645"
dobj = PBXGenericObject().parse(obj)
self.assertIsInstance(dobj, PBXKey)
def _parse_string(self, obj):
if re.match('([0-9A-F]{24})', obj) is not None:
return PBXKey(obj, self)
return obj
def _format(self, value, indentation_depth=u'', entry_separator=u'\n', object_start=u'\n',
indentation_increment=u'\t'):
if hasattr(value, u'_print_object'):
value = value._print_object(indentation_depth + indentation_increment,
entry_separator,
object_start,
indentation_increment)
elif isinstance(value, list):
value = self._print_list(value, indentation_depth + indentation_increment,
entry_separator,
object_start,
indentation_increment)
elif isinstance(value, PBXKey):
value = value.__repr__()
else:
value = PBXGenericObject._escape(value.__str__(), exclude=[u"\'"])
return value