@@ -55,6 +55,10 @@ def semi_negative_trace():
5555##########
5656# LENGTH #
5757##########
58+ def test_length_of_zero_element_trace_is_zero ():
59+ assert len (EnergyTrace ([])) == 0
60+
61+
5862def test_length_of_one_element_trace_is_one (trace_with_one_sample ):
5963 assert len (trace_with_one_sample )
6064
@@ -66,7 +70,6 @@ def test_length_of_two_elements_trace_is_two(trace_with_two_sample):
6670##################
6771# LIST INTERFACE #
6872##################
69-
7073def test_create_trace_with_one_sample_and_get_second_element_must_raise_IndexError (trace_with_one_sample ):
7174 with pytest .raises (IndexError ):
7275 trace_with_one_sample [1 ]
@@ -99,10 +102,27 @@ def test_create_trace_with_one_sample_and_get_tag_of_the_first_element_must_retu
99102 assert trace_with_one_sample ['tag1' ] == SAMPLE_1
100103
101104
102- def test_create_trace_with_one_sample_and_get_tag_of_the_second_element_must_return_second_element (trace_with_two_sample ):
105+ def test_create_trace_with_two_sample_and_get_tag_of_the_second_element_must_return_second_element (trace_with_two_sample ):
103106 assert trace_with_two_sample ['tag2' ] == SAMPLE_2
104107
105108
109+ def test_create_trace_with_one_sample_and_use_in_keyword_to_check_if_tag_is_present_return_true (trace_with_one_sample ):
110+ assert 'tag1' in trace_with_one_sample
111+
112+
113+ def test_create_trace_with_one_sample_and_use_in_keyword_to_check_if_bad_tag_is_present_return_false (trace_with_one_sample ):
114+ assert not 'bad_tag' in trace_with_one_sample
115+
116+
117+ def test_get_sample_on_a_two_sample_trace_with_same_names_return_first_sample ():
118+ s1 = EnergySample ('123' , 'tag1' , 10 , {'domain1' : 1 , 'domain2' : 2 })
119+ s2 = EnergySample ('456' , 'tag1' , 20 , {'domain2' : 2 , 'domain3' : 3 })
120+
121+ trace = EnergyTrace ([s1 , s2 ])
122+
123+ assert trace ['tag1' ] == s1
124+
125+
106126###########
107127# ITERATE #
108128###########
0 commit comments