def test_locale_html():
 testfield = Mock()
 this_lang = translation.get_language()
 testfield.locale = this_lang
 s = helpers.locale_html(testfield)
 assert (not s), 'no special HTML attributes for site language'
 testfield.locale = 'de'
 s = helpers.locale_html(testfield)
 eq_(s, ' lang="de" dir="ltr"')
 for lang in settings.RTL_LANGUAGES:
  testfield.locale = lang
  s = helpers.locale_html(testfield)
  eq_(s, (' lang="%s" dir="rtl"' % testfield.locale))

def test_locale_html ( ) : testfield = Mock ( ) this_lang = translation . get_language ( ) testfield . locale = this_lang s = helpers . locale_html ( testfield ) assert ( not s ) , 'no special HTML attributes for site language' testfield . locale = 'de' s = helpers . locale_html ( testfield ) eq_ ( s , ' lang="de" dir="ltr"' ) for lang in settings . RTL_LANGUAGES : testfield . locale = lang s = helpers . locale_html ( testfield ) eq_ ( s , ( ' lang="%s" dir="rtl"' % testfield . locale ) )
test html attributes for languages different than the site language .