Exemplo n.º 1
0
Arquivo: models.py Projeto: jinz/YACS
 def days_of_week(self, days):
     "Sets the days of the week using a tuple of strings or MONDAY-SUNDAY constants."
     dow = dict((n, v) for v, n in self.DAYS_OF_WEEK)
     value = 0
     for name in set(days):
         if type(name) in (str, unicode):
             value += dow.get(capitalized(name), 0)
         else:
             value += int(name) or 0
     self.days_of_week_flag = value
Exemplo n.º 2
0
 def days_of_week(self, days):
     "Sets the days of the week using a tuple of strings or MONDAY-SUNDAY constants."
     dow = dict((n, v) for v, n in self.DAYS_OF_WEEK)
     value = 0
     for name in set(days):
         if type(name) in (str, unicode):
             value += dow.get(capitalized(name), 0)
         else:
             value += int(name) or 0
     self.days_of_week_flag = value
Exemplo n.º 3
0
 def test_capitalization_for_all_lowercase(self):
     self.assertEqual(utils.capitalized("foobar"), "Foobar")
Exemplo n.º 4
0
 def test_capitalization_spaces(self):
     self.assertEqual(utils.capitalized("   "), "   ")
Exemplo n.º 5
0
 def test_capitalization_for_blank(self):
     self.assertEqual(utils.capitalized(""), "")
Exemplo n.º 6
0
 def test_capitalization_for_letter(self):
     self.assertEqual(utils.capitalized("a"), "A")
Exemplo n.º 7
0
 def test_capitalization_for_mixed_case(self):
     self.assertEqual(utils.capitalized("fOoBaR"), "Foobar")
Exemplo n.º 8
0
 def test_capitalization_for_all_uppercase(self):
     self.assertEqual(utils.capitalized("FOOBAR"), "Foobar")
Exemplo n.º 9
0
 def test_capitalization_spaces(self):
     self.assertEqual(utils.capitalized("   "), "   ")
Exemplo n.º 10
0
 def test_capitalization_for_blank(self):
     self.assertEqual(utils.capitalized(""), "")
Exemplo n.º 11
0
 def test_capitalization_for_letter(self):
     self.assertEqual(utils.capitalized("a"), "A")
Exemplo n.º 12
0
 def test_capitalization_for_mixed_case(self):
     self.assertEqual(utils.capitalized("fOoBaR"), "Foobar")
Exemplo n.º 13
0
 def test_capitalization_for_all_uppercase(self):
     self.assertEqual(utils.capitalized("FOOBAR"), "Foobar")
Exemplo n.º 14
0
 def test_capitalization_for_all_lowercase(self):
     self.assertEqual(utils.capitalized("foobar"), "Foobar")