def test_get_name_returns_localized_week_day_name(self):
     day = WeekDay(0)
     assert day.get_name() == u'maanantaina'
 def test_override_get_locale_as_class_method(self):
     day = WeekDay(0)
     assert day.get_name() == u'maanantaina'
Exemple #3
0
 def test_str(self):
     day = WeekDay(0)
     flexmock(day).should_receive('name').and_return(u'maanantaina')
     assert str(day) == 'maanantaina'
Exemple #4
0
 def test_constructor_with_valid_bit_string(self):
     days = WeekDays('1000100')
     assert days._days == set([WeekDay(0), WeekDay(4)])
Exemple #5
0
 def test_name_delegates_to_get_name(self):
     day = WeekDay(0)
     flexmock(day).should_receive('get_name').and_return(u'maanantaina')
     assert day.name == u'maanantaina'
Exemple #6
0
 def test_unicode(self):
     day = WeekDay(0)
     flexmock(day).should_receive('name').and_return(u'maanantaina')
     assert six.text_type(day) == u'maanantaina'
Exemple #7
0
 def test_get_name_returns_localized_week_day_name(self):
     day = WeekDay(0)
     assert day.get_name() == u'maanantaina'
Exemple #8
0
 def test_override_get_locale_as_class_method(self):
     day = WeekDay(0)
     assert day.get_name() == u'maanantaina'
Exemple #9
0
 def test_representation(self):
     day = WeekDay(1)
     assert repr(day) == "WeekDay(1)"
Exemple #10
0
 def test_position(self, index, first_week_day, position):
     i18n.get_locale = flexmock(first_week_day=first_week_day)
     day = WeekDay(index)
     assert day.position == position
Exemple #11
0
 def test_hash_is_equal_to_index_hash(self):
     day = WeekDay(1)
     assert hash(day) == hash(day.index)
Exemple #12
0
 def test_equality_with_unsupported_comparison(self):
     day = WeekDay(1)
     assert day != 'foobar'
Exemple #13
0
 def test_equality_with_unequal_week_day(self):
     day = WeekDay(1)
     day2 = WeekDay(2)
     assert day != day2
Exemple #14
0
 def test_constructor_with_invalid_index(self, index):
     with pytest.raises(ValueError):
         WeekDay(index)
Exemple #15
0
 def test_constructor_with_valid_index(self):
     day = WeekDay(1)
     assert day.index == 1