1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 from telemetry
.util
import matching
10 class BenchmarkFoo(object):
11 """ Benchmark Foo for testing."""
17 class BenchmarkBar(object):
18 """ Benchmark Bar for testing long description line."""
21 return 'BarBenchmarkkkkk'
24 class UnusualBenchmark(object):
27 return 'I have a very unusual name'
30 class CommandLineUnittest(unittest
.TestCase
):
31 def testGetMostLikelyMatchedObject(self
):
32 # Test moved from telemetry/benchmark_runner_unittest.py
33 all_benchmarks
= [BenchmarkFoo
, BenchmarkBar
, UnusualBenchmark
]
35 [BenchmarkFoo
, BenchmarkBar
],
36 matching
.GetMostLikelyMatchedObject(
37 all_benchmarks
, 'BenchmarkFooz', name_func
=lambda x
: x
.Name()))
40 [BenchmarkBar
, BenchmarkFoo
],
41 matching
.GetMostLikelyMatchedObject(
42 all_benchmarks
, 'BarBenchmark', name_func
=lambda x
: x
.Name()))
46 matching
.GetMostLikelyMatchedObject(
47 all_benchmarks
, 'unusual', name_func
=lambda x
: x
.Name()))