MCPcopy Create free account
hub / github.com/dateutil/dateutil / RelativeDeltaWeeksPropertySetterTest

Class RelativeDeltaWeeksPropertySetterTest

tests/test_relativedelta.py:758–783  ·  view source on GitHub ↗

Test the weeks setter which makes a "smart" update of the days attribute

Source from the content-addressed store, hash-verified

756
757
758class RelativeDeltaWeeksPropertySetterTest(unittest.TestCase):
759 """Test the weeks setter which makes a "smart" update of the days attribute"""
760
761 def test_one_day_set_one_week(self):
762 rd = relativedelta(days=1)
763 rd.weeks = 1 # add 7 days
764 self.assertEqual(rd.days, 8)
765 self.assertEqual(rd.weeks, 1)
766
767 def test_minus_one_day_set_one_week(self):
768 rd = relativedelta(days=-1)
769 rd.weeks = 1 # add 7 days
770 self.assertEqual(rd.days, 6)
771 self.assertEqual(rd.weeks, 0)
772
773 def test_height_days_set_minus_one_week(self):
774 rd = relativedelta(days=8)
775 rd.weeks = -1 # change from 1 week, 1 day to -1 week, 1 day
776 self.assertEqual(rd.days, -6)
777 self.assertEqual(rd.weeks, 0)
778
779 def test_minus_height_days_set_minus_one_week(self):
780 rd = relativedelta(days=-8)
781 rd.weeks = -1 # does not change anything
782 self.assertEqual(rd.days, -8)
783 self.assertEqual(rd.weeks, -1)
784
785
786# vim:ts=4:sw=4:et

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected