@@ -0,0 +1,2311 @@
+#!/usr/bin/python2.4%0A# Copyright 2008 Google Inc. All Rights Reserved.%0A%0A%22%22%22Tests for util functions.%22%22%22%0A%0A__author__ = 'Mark Roach (mrroach@google.com)'%0A%0Aimport datetime%0Aimport unittest%0Afrom pyactiveresource import util%0A%0A%0Aclass UtilTest(unittest.TestCase):%0A    def setUp(self):%0A        %22%22%22Create test objects.%22%22%22%0A%0A    def test_xml_to_dict_single_record(self):%0A        %22%22%22Test the xml_to_dict function.%22%22%22%0A        topic_xml = '''%3Ctopic%3E%0A             %3Ctitle%3EThe First Topic%3C/title%3E%0A             %3Cauthor-name%3EDavid%3C/author-name%3E%0A             %3Cid type=%22integer%22%3E1%3C/id%3E%0A             %3Capproved type=%22boolean%22%3E true %3C/approved%3E%0A             %3Creplies-count type=%22integer%22%3E0%3C/replies-count%3E%0A             %3Creplies-close-in type=%22integer%22%3E2592000000%3C/replies-close-in%3E%0A             %3Cwritten-on type=%22date%22%3E2003-07-16%3C/written-on%3E%0A             %3Cviewed-at type=%22datetime%22%3E2003-07-16T09:28:00+0000%3C/viewed-at%3E%0A             %3Ccontent type=%22yaml%22%3E--- %5Cn1: should be an integer%5Cn:message: Have a nice day%5Cnarray: %5Cn- should-have-dashes: true%5Cn  should_have_underscores: true%5Cn%3C/content%3E%0A             %3Cauthor-email-address%3Edavid@loudthinking.com%3C/author-email-address%3E%0A             %3Cparent-id%3E%3C/parent-id%3E%0A             %3Cad-revenue type=%22decimal%22%3E1.5%3C/ad-revenue%3E%0A             %3Coptimum-viewing-angle type=%22float%22%3E135%3C/optimum-viewing-angle%3E%0A             %3Cresident type=%22symbol%22%3Eyes%3C/resident%3E%0A           %3C/topic%3E'''%0A%0A        expected_topic_dict = %7B%0A            'title': 'The First Topic',%0A            'author_name': 'David',%0A            'id': 1,%0A            'approved': True,%0A            'replies_count': 0,%0A            'replies_close_in': 2592000000,%0A            'written_on': datetime.date(2003, 7, 16),%0A            'viewed_at': datetime.datetime(2003, 7, 16, 9, 28),%0A            'content': %7B'message': 'Have a nice day',%0A                        1: 'should be an integer',%0A                        'array': %5B%7B'should-have-dashes': True,%0A                                   'should_have_underscores': True%7D%5D%7D,%0A            'author_email_address': 'david@loudthinking.com',%0A            'parent_id': None,%0A            'ad_revenue': 1.5,%0A            'optimum_viewing_angle': 135.0,%0A            'resident': 'yes'%7D%0A        self.assertEqual(expected_topic_dict, util.xml_to_dict(topic_xml))%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A

Add util_test.py