MCPcopy Create free account
hub / github.com/microsoft/debugpy / test_occurrences

Function test_occurrences

tests/tests/test_timeline.py:70–122  ·  view source on GitHub ↗
(make_timeline)

Source from the content-addressed store, hash-verified

68
69@pytest.mark.timeout(1)
70def test_occurrences(make_timeline):
71 timeline, initial_history = make_timeline()
72
73 mark1 = timeline.mark("dum")
74 mark2 = timeline.mark("dee")
75 mark3 = timeline.mark("dum")
76
77 assert mark1 == Mark("dum")
78 assert mark1.id == "dum"
79 assert mark2 == Mark("dee")
80 assert mark2.id == "dee"
81 assert mark3 == Mark("dum")
82 assert mark3.id == "dum"
83
84 with timeline.frozen():
85 assert timeline.history() == initial_history + [
86 some.object.same_as(mark1),
87 some.object.same_as(mark2),
88 some.object.same_as(mark3),
89 ]
90 timeline.finalize()
91
92 assert timeline.all_occurrences_of(Mark("dum")) == (
93 some.object.same_as(mark1),
94 some.object.same_as(mark3),
95 )
96 assert timeline.all_occurrences_of(Mark("dee")) == (some.object.same_as(mark2),)
97
98 assert timeline[:].all_occurrences_of(Mark("dum")) == (
99 some.object.same_as(mark1),
100 some.object.same_as(mark3),
101 )
102
103 # Lower boundary is inclusive.
104 assert timeline[mark1:].all_occurrences_of(Mark("dum")) == (
105 some.object.same_as(mark1),
106 some.object.same_as(mark3),
107 )
108 assert timeline[mark2:].all_occurrences_of(Mark("dum")) == (
109 some.object.same_as(mark3),
110 )
111 assert timeline[mark3:].all_occurrences_of(Mark("dum")) == (
112 some.object.same_as(mark3),
113 )
114
115 # Upper boundary is exclusive.
116 assert timeline[:mark1].all_occurrences_of(Mark("dum")) == ()
117 assert timeline[:mark2].all_occurrences_of(Mark("dum")) == (
118 some.object.same_as(mark1),
119 )
120 assert timeline[:mark3].all_occurrences_of(Mark("dum")) == (
121 some.object.same_as(mark1),
122 )
123
124
125def expectation_of(message):

Callers

nothing calls this directly

Calls 8

MarkFunction · 0.90
make_timelineFunction · 0.85
markMethod · 0.80
frozenMethod · 0.80
historyMethod · 0.80
same_asMethod · 0.80
finalizeMethod · 0.45
all_occurrences_ofMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…