Skip to content

Commit

Permalink
Merge pull request #7 from jedipi/feature/no-none-typing
Browse files Browse the repository at this point in the history
don't try to type values as none
  • Loading branch information
staffanm committed Jul 27, 2016
2 parents 8e74bed + c36b42d commit ac28d07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion layeredconfig/dictsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def subsection(self, key):

def typed(self, key):
# if we have it, we can type it
return key in self.source
return key in self.source and self.source[key] is not None

def has(self, key):
# should has return true for types or only for real values?
Expand Down
6 changes: 6 additions & 0 deletions tests/test_layeredconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,12 @@ def test_commandline_implicit_typing(self):
cfg = LayeredConfig(Defaults({}), cmdlinesrc)
self.assertEqual(cfg.force, True)

def test_layered_typing_for_none_values_in_lower_priority(self):
source1 = Defaults({'key': None})
source2 = Environment({'KEY': 3})
config = LayeredConfig(source1, source2)
self.assertEquals(config.key, 3)


class TestTypingINIFile(TestINIFileHelper,
TestLayeredConfigHelper,
Expand Down

0 comments on commit ac28d07

Please sign in to comment.