# HG changeset patch # User Jeff Hammel # Date 1332877816 25200 # Node ID 84fb8ad5ba8136e5e0c4f20a648e428a8bab7849 # Parent 7abea9a6fa16420bba52ae3367f7a78a267870e2 ensure that missing values raise the correct exception diff -r 7abea9a6fa16 -r 84fb8ad5ba81 configuration/config.py --- a/configuration/config.py Tue Mar 27 12:32:15 2012 -0700 +++ b/configuration/config.py Tue Mar 27 12:50:16 2012 -0700 @@ -22,7 +22,7 @@ except ImportError: yaml = None -__all__ = ['Configuration', 'configuration_providers', 'types', 'MissingValueException', 'ConfigurationProviderException', 'ConfigurationOption'] +__all__ = ['Configuration', 'configuration_providers', 'types', 'MissingValueException', 'ConfigurationProviderException', 'TypeCastException', 'ConfigurationOption'] ### exceptions diff -r 7abea9a6fa16 -r 84fb8ad5ba81 tests/unit.py --- a/tests/unit.py Tue Mar 27 12:32:15 2012 -0700 +++ b/tests/unit.py Tue Mar 27 12:50:16 2012 -0700 @@ -73,6 +73,18 @@ if os.path.exists(filename): os.remove(filename) + def test_missing_values(self): + """ensure that Configuration raises a missing value exception""" + + example = ExampleConfiguration() + + exception = None + try: + example.parse(args=[]) + except Exception, exception: + pass + self.assertTrue(isinstance(exception, configuration.TypeCastException)) + def test_required(self): """ensure you have to have required values"""