Skip to content

Commit

Permalink
🐛 back TestExplicitBoolParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hi-king committed May 8, 2022
1 parent ef4f870 commit ef97e39
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions test/test_explicit_bool_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ def run(self):
ExplicitParsing._param = self.param


# class TestExplicitBoolParameter(unittest.TestCase):

# def test_bool_default(self):
# self.assertTrue(WithDefaultTrue().param)
# self.assertFalse(WithDefaultFalse().param)

# def test_parse_param(self):
# in_parse(['ExplicitParsing', '--param', 'true'], lambda task: self.assertTrue(task.param))
# in_parse(['ExplicitParsing', '--param', 'false'], lambda task: self.assertFalse(task.param))
# in_parse(['ExplicitParsing', '--param', 'True'], lambda task: self.assertTrue(task.param))
# in_parse(['ExplicitParsing', '--param', 'False'], lambda task: self.assertFalse(task.param))

# def test_missing_parameter(self):
# with self.assertRaises(luigi.parameter.MissingParameterException):
# in_parse(['ExplicitParsing'], lambda: True)

# def test_value_error(self):
# with self.assertRaises(ValueError):
# in_parse(['ExplicitParsing', '--param', 'Foo'], lambda: True)

# def test_expected_one_argment_error(self):
# # argparse throw "expected one argument" error
# with self.assertRaises(SystemExit):
# in_parse(['ExplicitParsing', '--param'], lambda: True)
class TestExplicitBoolParameter(unittest.TestCase):

def test_bool_default(self):
self.assertTrue(WithDefaultTrue().param)
self.assertFalse(WithDefaultFalse().param)

def test_parse_param(self):
in_parse(['ExplicitParsing', '--param', 'true'], lambda task: self.assertTrue(task.param))
in_parse(['ExplicitParsing', '--param', 'false'], lambda task: self.assertFalse(task.param))
in_parse(['ExplicitParsing', '--param', 'True'], lambda task: self.assertTrue(task.param))
in_parse(['ExplicitParsing', '--param', 'False'], lambda task: self.assertFalse(task.param))

def test_missing_parameter(self):
with self.assertRaises(luigi.parameter.MissingParameterException):
in_parse(['ExplicitParsing'], lambda: True)

def test_value_error(self):
with self.assertRaises(ValueError):
in_parse(['ExplicitParsing', '--param', 'Foo'], lambda: True)

def test_expected_one_argment_error(self):
# argparse throw "expected one argument" error
with self.assertRaises(SystemExit):
in_parse(['ExplicitParsing', '--param'], lambda: True)

0 comments on commit ef97e39

Please sign in to comment.