コード例 #1
0
class GlobalParamsMixinTest(unittest.TestCase):
    def setUp(self):
        self.obj = GlobalParamsMixin()

    def test_is_params_mixin(self):
        self.assertTrue(issubclass(GlobalParamsMixin, ParamsMixin))

    def test_has_prop_quiet(self):
        self.assertIsInstance(self.obj.quiet, BoolParameter)

    def test_has_prop_log_prefix(self):
        self.assertIsInstance(self.obj.log_prefix, ValueParameter)

    def test_has_prop_nocolor(self):
        self.assertIsInstance(self.obj.nocolor, BoolParameter)

    def test_params_to_line(self):
        self.obj.nocolor.toggle()
        self.assertRegex(self.obj.params_to_line(), "--nocolor")
        self.obj.quiet.toggle()
        self.assertRegex(self.obj.params_to_line(), "--nocolor")
        self.assertRegex(self.obj.params_to_line(), "--quiet")
コード例 #2
0
 def setUp(self):
     self.obj = GlobalParamsMixin()