Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: grit/format/policy_templates/writers/xml_writer_base_unittest.py

Issue 1442863002: Remove contents of grit's SVN repository. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/format/policy_templates/writers/xml_formatted_writer.py ('k') | grit/format/rc.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6
7 """Unittests for grit.format.policy_templates.writers.admx_writer."""
8
9
10 import re
11 import unittest
12
13
14 class XmlWriterBaseTest(unittest.TestCase):
15 '''Base class for XML writer unit-tests.
16 '''
17
18 def GetXMLOfChildren(self, parent):
19 '''Returns the XML of all child nodes of the given parent node.
20 Args:
21 parent: The XML of the children of this node will be returned.
22
23 Return: XML of the chrildren of the parent node.
24 '''
25 raw_pretty_xml = ''.join(
26 child.toprettyxml(indent=' ') for child in parent.childNodes)
27 # Python 2.6.5 which is present in Lucid has bug in its pretty print
28 # function which produces new lines around string literals. This has been
29 # fixed in Precise which has Python 2.7.3 but we have to keep compatibility
30 # with both for now.
31 text_re = re.compile('>\n\s+([^<>\s].*?)\n\s*</', re.DOTALL)
32 return text_re.sub('>\g<1></', raw_pretty_xml)
33
34 def AssertXMLEquals(self, output, expected_output):
35 '''Asserts if the passed XML arguements are equal.
36 Args:
37 output: Actual XML text.
38 expected_output: Expected XML text.
39 '''
40 self.assertEquals(output.strip(), expected_output.strip())
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/xml_formatted_writer.py ('k') | grit/format/rc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698