Fix brackets on get_all_runs_time_series_by_key
This commit fixes a small typo when get_all_runs_time_series_by_key was refactored to use the attrs of namedtuples instead of by index. Change-Id: If22a1e1ff50b5c7dedfa2b9a9a6d89062edcafe4
This commit is contained in:
parent
b2381a261c
commit
f8faf346f2
@ -1217,13 +1217,13 @@ def get_all_runs_time_series_by_key(key, start_date=None,
|
|||||||
}]}
|
}]}
|
||||||
else:
|
else:
|
||||||
if run.value not in list(runs[run.run_at].keys()):
|
if run.value not in list(runs[run.run_at].keys()):
|
||||||
runs[run.run_at[run.value]] = [{
|
runs[run.run_at][run.value] = [{
|
||||||
'pass': run.passes,
|
'pass': run.passes,
|
||||||
'fail': run.fails,
|
'fail': run.fails,
|
||||||
'skip': run.skips,
|
'skip': run.skips,
|
||||||
}]
|
}]
|
||||||
else:
|
else:
|
||||||
runs[run.run_at[run.value]].append({
|
runs[run.run_at][run.value].append({
|
||||||
'pass': run.passes,
|
'pass': run.passes,
|
||||||
'fail': run.fails,
|
'fail': run.fails,
|
||||||
'skip': run.skips,
|
'skip': run.skips,
|
||||||
|
@ -592,3 +592,21 @@ class TestDatabaseAPI(base.TestCase):
|
|||||||
'stop_time': stop_timestamp,
|
'stop_time': stop_timestamp,
|
||||||
'a_key': 'b',
|
'a_key': 'b',
|
||||||
}, result[0])
|
}, result[0])
|
||||||
|
|
||||||
|
def test_get_all_runs_time_series_by_key_with_overlap(self):
|
||||||
|
time_a = datetime.datetime(1914, 6, 28, 10, 45, 0)
|
||||||
|
run_a = api.create_run(run_at=time_a)
|
||||||
|
run_b = api.create_run()
|
||||||
|
time_c = datetime.datetime(1918, 11, 11, 11, 11, 11)
|
||||||
|
run_c = api.create_run(run_at=time_c)
|
||||||
|
run_d = api.create_run(run_at=time_a)
|
||||||
|
api.add_run_metadata({'not_a_key': 'not_a_value'}, run_b.id)
|
||||||
|
api.add_run_metadata({'a_key': 'a_value'}, run_a.id)
|
||||||
|
api.add_run_metadata({'a_key': 'c_value'}, run_c.id)
|
||||||
|
api.add_run_metadata({'a_key': 'a_value'}, run_d.id)
|
||||||
|
result = api.get_all_runs_time_series_by_key('a_key')
|
||||||
|
self.assertEqual(2, len(result.keys()))
|
||||||
|
self.assertIn(time_a.date(), [x.date() for x in result.keys()])
|
||||||
|
self.assertIn(time_c.date(), [x.date() for x in result.keys()])
|
||||||
|
self.assertIn(time_a.date(), [x.date() for x in result.keys()])
|
||||||
|
self.assertEqual(len(result[time_a]['a_value']), 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user