def test_invalid_number (self): date1 = Date(self.ruleset, 1, '1 A.D.') self.assertRaises(IllegalArgumentError, Date, self.ruleset, 1, '2 A.D.') date2 = Date(self.ruleset, 2, '2 A.D.') self.assertRaises(IllegalArgumentError, setattr, date2, 'number', 1) # Changing a number should make it possible for the old number # to be used by a different date. date2.number = 3 date1.number = 2 # A newly set number must also be unavailable to other dates. self.assertRaises(IllegalArgumentError, setattr, date2, 'number', 2)
def test_invalid_number(self): date1 = Date(self.ruleset, 1, '1 A.D.') self.assertRaises(IllegalArgumentError, Date, self.ruleset, 1, '2 A.D.') date2 = Date(self.ruleset, 2, '2 A.D.') self.assertRaises(IllegalArgumentError, setattr, date2, 'number', 1) # Changing a number should make it possible for the old number # to be used by a different date. date2.number = 3 date1.number = 2 # A newly set number must also be unavailable to other dates. self.assertRaises(IllegalArgumentError, setattr, date2, 'number', 2)
def test_dates(self): language = Language(self.ruleset, 'English') self.assertEqual(len(language.dates), 0) date1 = Date(self.ruleset, 1, '1 A.D.') language.add_date(date1) self.assertEqual(language.dates, [date1]) date2 = Date(self.ruleset, 2, '2 A.D.') language.add_date(date2) # Dates are ordered. self.assertEqual(language.dates, [date1, date2]) date2.number = -1 self.assertEqual(language.dates, [date2, date1]) date2.delete() self.assertEqual(language.dates, [date1]) date1.delete() self.assertEqual(len(language.dates), 0)
def test_number (self): date = Date(self.ruleset, 1, '1 A.D.') self.assertEqual(date.number, 1) date.number = 2 self.assertEqual(date.number, 2)
def test_number(self): date = Date(self.ruleset, 1, '1 A.D.') self.assertEqual(date.number, 1) date.number = 2 self.assertEqual(date.number, 2)