Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
clean up the code in TestTableConfigCompleter
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed May 20, 2017
1 parent 89c5e7d commit 126f7dd
Showing 1 changed file with 25 additions and 62 deletions.
87 changes: 25 additions & 62 deletions tests/unit/configure/test_TableConfigCompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,26 @@ class TestTableConfigCompleter(unittest.TestCase):
def setUp(self):
self.maxDiff = None # https://docs.python.org/2/library/unittest.html

def test_repr(self):
obj = TableConfigCompleter(
self.defaultWeight = MockWeight()
self.obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = MockWeight(),
defaultWeight = self.defaultWeight,
defaultOutDir = 'tmp'
)

def test_repr(self):
obj = self.obj
repr(obj)

def test_copy_not_the_same_object(self):
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = MockWeight(),
defaultOutDir = 'tmp'
)
obj = self.obj
tblcfg_in = dict(keyAttrNames = ('met_pt', ), binnings = (MockBinning(), ))
tblcfg_out = obj.complete(tblcfg_in)
self.assertIsNot(tblcfg_in, tblcfg_out)

def test_empty_input(self):
defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

expected = dict(
keyAttrNames = (),
Expand All @@ -71,12 +66,8 @@ def test_empty_input(self):

def test_simple_input(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()

Expand Down Expand Up @@ -109,12 +100,8 @@ def test_simple_input(self):

def test_default_summary_class_empty_key(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

expected = dict(
keyAttrNames = (),
Expand Down Expand Up @@ -145,12 +132,8 @@ def test_default_summary_class_empty_key(self):

def test_specify_summary_class_empty_key_empty_val(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

expected = dict(
keyAttrNames = (),
Expand Down Expand Up @@ -182,12 +165,8 @@ def test_specify_summary_class_empty_key_empty_val(self):

def test_specify_summary_class_2_keys_empty_vals(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()
binning2 = MockBinning()
Expand Down Expand Up @@ -222,12 +201,8 @@ def test_specify_summary_class_2_keys_empty_vals(self):

def test_specify_summary_class_2_keys_2_vals(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()
binning2 = MockBinning()
Expand Down Expand Up @@ -263,12 +238,8 @@ def test_specify_summary_class_2_keys_2_vals(self):

def test_specify_summary_class_2_keys_2_vals_key_indices(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()
binning2 = MockBinning()
Expand Down Expand Up @@ -305,12 +276,8 @@ def test_specify_summary_class_2_keys_2_vals_key_indices(self):

def test_specify_summary_class_2_keys_2_vals_val_indices(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()
binning2 = MockBinning()
Expand Down Expand Up @@ -347,12 +314,8 @@ def test_specify_summary_class_2_keys_2_vals_val_indices(self):

def test_specify_summary_class_2_keys_2_vals_key_indices_val_indices(self):

defaultWeight = MockWeight()
obj = TableConfigCompleter(
defaultSummaryClass = MockDefaultSummary,
defaultWeight = defaultWeight,
defaultOutDir = 'tmp'
)
obj = self.obj
defaultWeight = self.defaultWeight

binning1 = MockBinning()
binning2 = MockBinning()
Expand Down

0 comments on commit 126f7dd

Please sign in to comment.