diff --git a/nnfwtbn/process.py b/nnfwtbn/process.py index db5d360378465e544dd886a442e08d2384752c74..535eaed00a0c70b7a5a252df1a3f037c6cb5bcb3 100644 --- a/nnfwtbn/process.py +++ b/nnfwtbn/process.py @@ -11,15 +11,13 @@ class Process: DEFAULT_RANGE_VAR = 'fpid' - def __init__(self, label, selection=None, type="fill", range=None, - range_var=None, **kwds): + def __init__(self, label, selection=None, range=None, + range_var=None): r""" Returns a new process object. The process has a human-readable name (potentially using latex) and a selection cut. The selection argument - can be a cut object or any callable. The optional argument 'type' - defines how the process is displayed in a histogram. Possible values - are are 'fill', 'line' and 'points'. Stacking of processes is handled by - the plotting method. The default value is 'fill'. + can be a cut object or any callable. Stacking of processes is handled by + the plotting method. >>> Process("Top", lambda d: d.is_top) <Process 'Top': (func)> @@ -37,12 +35,6 @@ class Process: If the range_var argument is omitted, the value of Process.DEFAULT_RANGE_VAR is used, this defaults to 'fpid'. - - Any other Keyword argument is passed directly to the matplotlib upon - plotting. - - >>> Process("VBF", lambda d: d.is_VBFH, linestyle="--") - <Process 'VBF': (func)> """ ####################################################### # Selection @@ -77,18 +69,8 @@ class Process: " can be used.") ####################################################### - # Type - allowed_types = ["fill", "line", "point"] - if not type in allowed_types: - raise err.InvalidProcessType("Process type must be one of %s." % - repr(allowed_types)) - self.type = type - - ####################################################### - # Other + # Label self.label = label - self.type = type - self.mpl_kwds = kwds def __repr__(self): diff --git a/nnfwtbn/tests/test_process.py b/nnfwtbn/tests/test_process.py index dd55b2204a8948d907b610093b4102939e8e9e1b..96aa2ba8babf03e321ca398fe966b4a88b26d989 100644 --- a/nnfwtbn/tests/test_process.py +++ b/nnfwtbn/tests/test_process.py @@ -11,14 +11,25 @@ class ProcessTestCase(unittest.TestCase): """ Check that all arguments are stored internally. """ - process = Process("Top", selection=lambda d: d.is_top, - color='#fe0134', linewidth=2) + process = Process("Top", selection=lambda d: d.is_top) self.assertEqual(process.label, "Top") self.assertIsNotNone(process.selection) - self.assertEqual(process.type, "fill") - self.assertEqual(process.mpl_kwds, - {'color': '#fe0134', 'linewidth': 2}) + + + def test_no_type(self): + """ + Check that processes don't accept the 'type' argument. + """ + self.assertRaises(TypeError, Process, "Top", type="fill", + selection=lambda d: d.is_top) + + def test_no_color(self): + """ + Check that processes don't accept the 'color' argument. + """ + self.assertRaises(TypeError, Process, "Top", color="#ff0000", + selection=lambda d: d.is_top) def test_lambda(self): @@ -82,23 +93,6 @@ class ProcessTestCase(unittest.TestCase): process = Process("Top", range=(5, 10), range_var="yet_another") self.assertEqual(process.range_var, "yet_another") - def test_type_values(self): - """ - Check that allowed type values are stored. Check that an error is - raised if an illegal value is passed to the constructor. - """ - process = Process("Top", selection=lambda d: d.is_top, type='fill') - self.assertEqual(process.type, 'fill') - - process = Process("Top", selection=lambda d: d.is_top, type='point') - self.assertEqual(process.type, 'point') - - process = Process("Top", selection=lambda d: d.is_top, type='line') - self.assertEqual(process.type, 'line') - - self.assertRaises(ValueError, Process, "Top", selection=lambda d: d.is_top, - type='other') - def test_range_type(self): """ Check that an exception is raised if the range argument is not a tuple