class TestEstimation(unittest.TestCase): def setUp(self): self.widget = Estimation('5h') def test_math_num(self): self.assertEqual(self.widget.num, 5) def test_math_pars(self): self.assertEqual(self.widget.pars(), '5h') def test_math_pars_day(self): widget = Estimation('20h') self.assertEqual(widget.pars(), '2d4h') def test_math_creat_day(self): widget = Estimation('5d') self.assertEqual(widget.num, 40) def test_math_creat_pars_day(self): widget = Estimation('5d') self.assertEqual(widget.pars(), '1w') def test_math_creat_week(self): widget = Estimation('5w') self.assertEqual(widget.num, 200) def test_math_creat_pars_week(self): widget = Estimation('5w') self.assertEqual(widget.pars(), '1m1w') def test_math_creat_month(self): widget = Estimation('5m') self.assertEqual(widget.num, 800) def test_math_creat_pars_month(self): widget = Estimation('5m') self.assertEqual(widget.pars(), '5m') def test_add_is_obj(self): widget1 = Estimation('2h') widget2 = Estimation('2h') widget3 = widget1 + widget2 self.assertIsInstance(widget3, Estimation) def test_add_h(self): widget1 = Estimation('2h') widget2 = Estimation('2h') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '4h') def test_add_d(self): widget1 = Estimation('7h') widget2 = Estimation('1h') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '1d') def test_add_d_h(self): widget1 = Estimation('9h') widget2 = Estimation('1h') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '1d2h') def test_add_d_d(self): widget1 = Estimation('4d') widget2 = Estimation('1d') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '1w') def test_add_w_d(self): widget1 = Estimation('2w') widget2 = Estimation('2d') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '2w2d') def test_add_w_w(self): widget1 = Estimation('4w') widget2 = Estimation('1w') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '1m1w') def test_add_m_d(self): widget1 = Estimation('2m') widget2 = Estimation('5d') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '2m1w') def test_add_interesting(self): widget1 = Estimation('256h') widget2 = Estimation('16d') widget3 = widget1 + widget2 self.assertEqual(widget3.pars(), '2m1w3d')
def test_math_creat_pars_month(self): widget = Estimation('5m') self.assertEqual(widget.pars(), '5m')
def test_math_creat_pars_day(self): widget = Estimation('5d') self.assertEqual(widget.pars(), '1w')
def test_math_creat_pars_week(self): widget = Estimation('5w') self.assertEqual(widget.pars(), '1m1w')
def test_math_pars_day(self): widget = Estimation('20h') self.assertEqual(widget.pars(), '2d4h')