Mercurial > hg > configuration
comparison tests/unit.py @ 116:9d19ed8fd883
https://bugzilla.mozilla.org/show_bug.cgi?id=796196
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Mon, 01 Oct 2012 17:08:45 -0700 |
| parents | 56db0b2b90af |
| children | dff886188b55 |
comparison
equal
deleted
inserted
replaced
| 115:56db0b2b90af | 116:9d19ed8fd883 |
|---|---|
| 201 | 201 |
| 202 # ensure it works correctly | 202 # ensure it works correctly |
| 203 expected = datetime.datetime(2012, 7, 4, 0, 0) | 203 expected = datetime.datetime(2012, 7, 4, 0, 0) |
| 204 self.assertEqual(example.config['datestring'], expected) | 204 self.assertEqual(example.config['datestring'], expected) |
| 205 | 205 |
| 206 | |
| 207 def test_added(self): | |
| 208 """test that we keep track of things added to the configuration""" | |
| 209 | |
| 210 # make an example class | |
| 211 class AddedExample(configuration.Configuration): | |
| 212 options = {'foo': {}, | |
| 213 'bar': {}} | |
| 214 | |
| 215 # parse it; there should be nothing | |
| 216 instance = AddedExample() | |
| 217 instance() | |
| 218 self.assertEqual(instance.added, set()) | |
| 219 | |
| 220 # parse it; there should be one thing | |
| 221 instance = AddedExample() | |
| 222 instance({'foo': 'foo'}) | |
| 223 self.assertEqual(instance.added, set(['foo'])) | |
| 224 | |
| 225 # parse it; there should be two things | |
| 226 instance = AddedExample() | |
| 227 instance({'foo': 'foo'}, {'foo': 'FOO', 'bar': 'bar'}) | |
| 228 self.assertEqual(instance.added, set(['foo', 'bar'])) | |
| 229 | |
| 206 if __name__ == '__main__': | 230 if __name__ == '__main__': |
| 207 unittest.main() | 231 unittest.main() |
