def test_value_error(self, Locale): """ If Locale.parse raises a ValueError, return the en-US locale object. """ Locale.parse.side_effect = ValueError eq_(helpers.current_locale(), Locale.return_value) Locale.assert_called_with('en', 'US')
def test_unknown_locale(self, Locale): """ If Locale.parse raises an UnknownLocaleError, return the en-US locale object. """ Locale.parse.side_effect = UnknownLocaleError('foo') eq_(helpers.current_locale(), Locale.return_value) Locale.assert_called_with('en', 'US')
def test_success(self, Locale, get_language): eq_(helpers.current_locale(), Locale.parse.return_value) Locale.parse.assert_called_with(get_language.return_value, sep='-')