Changeset c53a2fa929ed…
Parent 8106b9e458f9…
by
Changes to 2 files · Browse files at c53a2fa929ed Showing diff from parent 8106b9e458f9 Diff from another changeset...
@@ -87,6 +87,14 @@ assert not c.get('unknown', 'bar')
@with_both
+def check_set_followed_by_getitem_empty():
+ c = newwconfig()
+ c['unknown']
+ c.set('unknown', 'foo', 'bar')
+ assert_equals('bar', c.get('unknown', 'foo'))
+ assert_equals('bar', c['unknown']['foo'])
+
+@with_both
def check_dict_contains():
c = newwconfig({'foo.bar': 'x'})
assert 'bar' in c['foo']
|
@@ -134,8 +134,11 @@ try:
return self._sections[section]
except KeyError:
- self._sections[section] = _wsortdict(self._config[section])
- return self._sections[section]
+ if self._config[section]:
+ self._sections[section] = _wsortdict(self._config[section])
+ return self._sections[section]
+ else:
+ return {}
def __iter__(self):
return iter(self._config)
|
Loading...