def test_no_translation():
 old_lang = translation.get_language()
 try:
  translation.activate('pt-br')
  with no_translation():
   assert (translation.get_language().lower() == settings.LANGUAGE_CODE.lower())
  assert (translation.get_language() == 'pt-br')
  with no_translation('es'):
   assert (translation.get_language() == 'es')
  assert (translation.get_language() == 'pt-br')
 finally:
  translation.activate(old_lang)

def test_no_translation ( ) : old_lang = translation . get_language ( ) try : translation . activate ( 'pt-br' ) with no_translation ( ) : assert ( translation . get_language ( ) . lower ( ) == settings . LANGUAGE_CODE . lower ( ) ) assert ( translation . get_language ( ) == 'pt-br' ) with no_translation ( 'es' ) : assert ( translation . get_language ( ) == 'es' ) assert ( translation . get_language ( ) == 'pt-br' ) finally : translation . activate ( old_lang )
no_translation provides a context where only the default language is active .