| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ Unit tests for the easy_xml.py file. """ | 7 """ Unit tests for the easy_xml.py file. """ |
| 8 | 8 |
| 9 import gyp.easy_xml as easy_xml | 9 import gyp.easy_xml as easy_xml |
| 10 import unittest | 10 import unittest |
| 11 import StringIO | 11 try: |
| 12 from StringIO import StringIO |
| 13 except ImportError: |
| 14 from io import StringIO |
| 12 | 15 |
| 13 | 16 |
| 14 class TestSequenceFunctions(unittest.TestCase): | 17 class TestSequenceFunctions(unittest.TestCase): |
| 15 | 18 |
| 16 def setUp(self): | 19 def setUp(self): |
| 17 self.stderr = StringIO.StringIO() | 20 self.stderr = StringIO() |
| 18 | 21 |
| 19 def test_EasyXml_simple(self): | 22 def test_EasyXml_simple(self): |
| 20 self.assertEqual( | 23 self.assertEqual( |
| 21 easy_xml.XmlToString(['test']), | 24 easy_xml.XmlToString(['test']), |
| 22 '<?xml version="1.0" encoding="utf-8"?><test/>') | 25 '<?xml version="1.0" encoding="utf-8"?><test/>') |
| 23 | 26 |
| 24 self.assertEqual( | 27 self.assertEqual( |
| 25 easy_xml.XmlToString(['test'], encoding='Windows-1252'), | 28 easy_xml.XmlToString(['test'], encoding='Windows-1252'), |
| 26 '<?xml version="1.0" encoding="Windows-1252"?><test/>') | 29 '<?xml version="1.0" encoding="Windows-1252"?><test/>') |
| 27 | 30 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 'Label': 'Configuration'}, | 97 'Label': 'Configuration'}, |
| 95 ['ConfigurationType', 'Application'], | 98 ['ConfigurationType', 'Application'], |
| 96 ['CharacterSet', 'Unicode'] | 99 ['CharacterSet', 'Unicode'] |
| 97 ] | 100 ] |
| 98 ]) | 101 ]) |
| 99 self.assertEqual(xml, target) | 102 self.assertEqual(xml, target) |
| 100 | 103 |
| 101 | 104 |
| 102 if __name__ == '__main__': | 105 if __name__ == '__main__': |
| 103 unittest.main() | 106 unittest.main() |
| OLD | NEW |