[CalendarServer-changes] [11425] CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/ python
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 26 01:17:58 PDT 2013
Revision: 11425
http://trac.calendarserver.org//changeset/11425
Author: glyph at apple.com
Date: 2013-06-26 01:17:57 -0700 (Wed, 26 Jun 2013)
Log Message:
-----------
Test for nested arrays.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py
CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py
Modified: CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py
===================================================================
--- CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py 2013-06-26 08:17:33 UTC (rev 11424)
+++ CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py 2013-06-26 08:17:57 UTC (rev 11425)
@@ -162,7 +162,7 @@
result[k] = plainPython(v)
return result
elif isinstance(x, LaunchArray):
- return list(x)
+ return map(plainPython, x)
else:
return x
Modified: CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py
===================================================================
--- CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py 2013-06-26 08:17:33 UTC (rev 11424)
+++ CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py 2013-06-26 08:17:57 UTC (rev 11425)
@@ -196,7 +196,20 @@
[b"test-string-1", b"another string.", 4321])
+ def test_plainPythonNested(self):
+ """
+ L{plainPython} converts a L{LaunchArray} containing another
+ L{LaunchArray} into a Python list.
+ """
+ sub = lib.launch_data_alloc(lib.LAUNCH_DATA_ARRAY)
+ lib.launch_data_array_set_index(sub, lib.launch_data_new_integer(7), 0)
+ lib.launch_data_array_set_index(self.testArray, sub, 3)
+ array = LaunchArray(self.testArray)
+ self.assertEqual(plainPython(array), [b"test-string-1",
+ b"another string.", 4321, [7]])
+
+
class SimpleStringConstants(TestCase):
"""
Tests for bytestring-constants wrapping.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130626/105b0b46/attachment-0001.html>
More information about the calendarserver-changes
mailing list