Skip to content

Commit 2d9f419

Browse files
committed
test: add additional unittests.
1 parent 0e14e09 commit 2d9f419

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/tests_pytorch/loggers/test_utilities.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,21 @@ def test_listmap_get():
242242
assert lm.get("b") == 2
243243
assert lm.get("d") is None
244244
assert lm.get("d", 10) == 10
245+
246+
247+
def test_listmap_setitem_append():
248+
lm = _ListMap({"a": 1, "b": 2})
249+
lm.append(3)
250+
lm["c"] = 3
251+
252+
assert lm == [1, 2, 3, 3]
253+
assert lm["c"] == 3
254+
255+
lm.remove(3)
256+
assert lm == [1, 2, 3]
257+
assert lm["c"] == 3
258+
259+
lm.remove(3)
260+
assert lm == [1, 2]
261+
with pytest.raises(KeyError):
262+
lm["c"] # "c" was removed

0 commit comments

Comments
 (0)