Skip to content

Commit 11ea3a8

Browse files
committed
test: cover SopelMemoryWithDefault.__contains__()
Since the whole point of this type is to have a thread-safe version of `collections.defaultdict` and not have to check for `'key' in SMWD` before accessing something, the `__contains__()` method (supporting the `in` keyword) is never exercised in regular code. The rest of `SopelMemoryWithDefault` is covered by other test cases for code that *uses* the type, so I'll just keep this patch small. Now the only uncovered code in `sopel/tools/memories.py` is for variadic argument handling that we plan to remove anyway, so 98% is fine for now.
1 parent 3037752 commit 11ea3a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/tools/test_tools_memories.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
from sopel.tools import identifiers, memories
77

88

9+
def test_sopel_default_memory_contains():
10+
memory = memories.SopelMemoryWithDefault(list)
11+
assert 'key' not in memory
12+
13+
914
def test_sopel_identifier_memory_none():
1015
memory = memories.SopelIdentifierMemory()
1116
assert None not in memory

0 commit comments

Comments
 (0)