def test_zero_time(self): for backend in self.backends: args = '--' + backend + ' perprof/tests/zero-time.sample ' + self.goodfiles args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertRaises(ValueError, self.back_profilers[backend], parser_options, profiler_options)
def test_empty_intersection(self): for backend in self.backends: args = '--' + backend + ' --demo --subset perprof/tests/fantasy.subset' args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertRaises(ValueError, self.back_profilers[backend], parser_options, profiler_options)
def test_no_success(self): for backend in self.backends: if backend == "raw": continue args = '--' + backend + ' perprof/tests/no-success.sample ' + self.goodfiles args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) data = self.back_profilers[backend](parser_options, profiler_options) self.assertRaises(ValueError, data.plot)
def test_columns(self): for backend in self.backends: baseargs = '--' + backend + ' ' + self.goodfiles #Default comparison needs 3 columns args = baseargs + ' perprof/tests/2-col.sample ' args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertRaises(ValueError, self.back_profilers[backend], parser_options, profiler_options) #Default values should fail with 5 or less columns. #Unconstrained Default values should fail with 5 or less columns #(because dual default column is 5). baseargs = '--compare optimalvalues ' + baseargs for xtra in ['', '--unconstrained ']: baseargs = xtra + baseargs for n in [2,3,4,5]: args = baseargs + ' perprof/tests/{}-col.sample '.format(n) args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertRaises(ValueError, self.back_profilers[backend], parser_options, profiler_options)
def test_output_formats(self): outputs = { "tikz": ["pdf", "tex"], "mp": ["png", "eps", "pdf", "ps", "svg"], "raw": [] } backends = self.backends for backend in backends: for output in outputs[backend]: args = '--' + backend + ' --' + output + ' --demo' args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertEqual(profiler_options['output_format'], output) data = self.back_profilers[backend](parser_options, profiler_options) if backend != "tikz": self.assertEqual(data.output, 'performance-profile.{}'.format(output))
def test_output_formats(self): outputs = { "bokeh": ["html"], "tikz": ["pdf", "tex"], "mp": ["png", "eps", "pdf", "ps", "svg"], "raw": [] } backends = self.backends for backend in backends: for output in outputs[backend]: args = '--' + backend + ' --' + output + ' --demo' args = set_arguments(args.split()) parser_options, profiler_options = process_arguments(args) self.assertEqual(profiler_options['output_format'], output) data = self.back_profilers[backend](parser_options, profiler_options) if backend != "tikz": self.assertEqual(data.output, 'performance-profile.{}'.format(output))