Skip to content

Commit

Permalink
Add set and frozenset to test data and fix test to use iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamYoblick committed Jan 16, 2024
1 parent 6d18659 commit b8559c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/debugpy/server/inspect/test_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_ChildItem_expr(key, value):
range(1, 4), # range
"foo", # string
array.array("i", [1, 2, 3]), # array
set([1, 2, 3]), # set
frozenset([1, 2, 3]), # frozenset
collections.namedtuple("Point", ["x", "y"])(1, 2), # namedtuple
collections.deque([1, 2, 3]), # deque
collections.UserList([1, 2, 3]), # UserList
Expand All @@ -58,19 +60,20 @@ def test_SequenceInspector_children(sequence):
inspector = SequenceInspector(sequence)
children = list(inspector.children())

# The children contain the length and the items, so the length should be 1 + len(sequence)
assert len(children) == 1 + len(sequence)
# The children contain the length and the items, so the length should be len(sequence) + 1
assert len(children) == len(sequence) + 1

# The first item is the length
assert isinstance(children[0], ChildLen)
assert children[0].name == "len()"
assert children[0].value == len(sequence)

# The rest of the items are the items in the sequence
iterator = iter(sequence)
for i, child in enumerate(children[1:], 0):
assert isinstance(child, ChildItem)
assert child.name == f"[{i}]"
assert child.value == sequence[i]
assert child.value == next(iterator)

mapping_inspector_test_data = [
{"key1": "value1", "key2": "value2"}, # dict
Expand Down

0 comments on commit b8559c4

Please sign in to comment.