mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-29 22:29:24 +01:00
Hmm, didn't define keys.
This commit is contained in:
parent
19a86f3873
commit
9def8a49bd
@ -601,8 +601,13 @@ class InsensitivePreservingDict(UserDict.DictMixin, object):
|
||||
del self.data[self.key(k)]
|
||||
|
||||
def iteritems(self):
|
||||
for t in self.data.itervalues():
|
||||
yield t
|
||||
return self.data.itervalues()
|
||||
|
||||
def keys(self):
|
||||
L = []
|
||||
for (k, _) in self.iteritems():
|
||||
L.append(k)
|
||||
return L
|
||||
|
||||
def __reduce__(self):
|
||||
return (self.__class__, (dict(self.data.values()),))
|
||||
|
@ -212,6 +212,10 @@ class IrcDictTestCase(unittest.TestCase):
|
||||
self.assertEqual(d['jemfinch[]'], 'bar')
|
||||
self.assertEqual(d['JEMFINCH[]'], 'bar')
|
||||
|
||||
def testKeys(self):
|
||||
d = ircutils.IrcDict()
|
||||
self.assertEqual(d.keys(), [])
|
||||
|
||||
def testSetdefault(self):
|
||||
d = ircutils.IrcDict()
|
||||
d.setdefault('#FOO', []).append(1)
|
||||
|
@ -349,6 +349,7 @@ class UtilsTest(unittest.TestCase):
|
||||
ipd = utils.InsensitivePreservingDict
|
||||
d = ipd(dict(Foo=10))
|
||||
self.failUnless(d['foo'] == 10)
|
||||
self.assertEqual(d.keys(), ['Foo'])
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user