mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
ODict.keys
This commit is contained in:
parent
f30df13384
commit
0fa6351965
@ -36,6 +36,9 @@ class ODict:
|
||||
ret.append(i[1])
|
||||
return ret
|
||||
|
||||
def keys(self):
|
||||
return list(set([self._kconv(i[0]) for i in self.lst]))
|
||||
|
||||
def _filter_lst(self, k, lst):
|
||||
k = self._kconv(k)
|
||||
new = []
|
||||
|
@ -63,6 +63,15 @@ class TestODict:
|
||||
self.od.add("foo", 1)
|
||||
assert [i for i in self.od]
|
||||
|
||||
def test_keys(self):
|
||||
assert not self.od.keys()
|
||||
self.od.add("foo", 1)
|
||||
assert self.od.keys() == ["foo"]
|
||||
self.od.add("foo", 2)
|
||||
assert self.od.keys() == ["foo"]
|
||||
self.od.add("bar", 2)
|
||||
assert len(self.od.keys()) == 2
|
||||
|
||||
def test_copy(self):
|
||||
self.od.add("foo", 1)
|
||||
self.od.add("foo", 2)
|
||||
@ -122,3 +131,13 @@ class TestODictCaseless:
|
||||
self.od.add("bar", 3)
|
||||
del self.od["foo"]
|
||||
assert len(self.od) == 1
|
||||
|
||||
def test_keys(self):
|
||||
assert not self.od.keys()
|
||||
self.od.add("foo", 1)
|
||||
assert self.od.keys() == ["foo"]
|
||||
self.od.add("Foo", 2)
|
||||
assert self.od.keys() == ["foo"]
|
||||
self.od.add("bar", 2)
|
||||
assert len(self.od.keys()) == 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user