Mercurial > hg > configuration
comparison tests/unit.py @ 131:dff886188b55
minor fixes
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 30 Mar 2014 19:27:41 -0700 |
parents | 9d19ed8fd883 |
children |
comparison
equal
deleted
inserted
replaced
130:6b798d23f99f | 131:dff886188b55 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 """ | 3 """ |
4 unit tests | 4 unit tests for configuration package |
5 """ | 5 """ |
6 | 6 |
7 import configuration | 7 import configuration |
8 import datetime | 8 import datetime |
9 import json | |
9 import os | 10 import os |
10 import sys | 11 import sys |
11 import tempfile | 12 import tempfile |
12 import unittest | 13 import unittest |
13 | |
14 try: | |
15 import json | |
16 except ImportError: | |
17 import simplejson as json | |
18 | 14 |
19 from example import ExampleConfiguration # example configuration to test | 15 from example import ExampleConfiguration # example configuration to test |
20 | 16 |
21 # globals | 17 # globals |
22 here = os.path.dirname(os.path.abspath(__file__)) | 18 here = os.path.dirname(os.path.abspath(__file__)) |
225 # parse it; there should be two things | 221 # parse it; there should be two things |
226 instance = AddedExample() | 222 instance = AddedExample() |
227 instance({'foo': 'foo'}, {'foo': 'FOO', 'bar': 'bar'}) | 223 instance({'foo': 'foo'}, {'foo': 'FOO', 'bar': 'bar'}) |
228 self.assertEqual(instance.added, set(['foo', 'bar'])) | 224 self.assertEqual(instance.added, set(['foo', 'bar'])) |
229 | 225 |
226 | |
230 if __name__ == '__main__': | 227 if __name__ == '__main__': |
231 unittest.main() | 228 unittest.main() |