code
stringlengths
3
6.57k
DENYLIST_ENDPOINT_TAGS.get(endpoint_name, [])
for (name, value)
zip(args_names, args)
flatten_dict(tags)
truncate_arg_value(v)
tags.items()
span.set_tags(tags)
range(2, 8)
range(i*2, 50, i)
range(2, 50)
print(difference)
range(1, 51)
any([y for y in range(2, int(math.sqrt(x)
print(primes)
super()
jingo.load_helpers()
test_locale_html()
Mock()
translation.get_language()
helpers.locale_html(testfield)
helpers.locale_html(testfield)
eq_(s, ' lang="de" dir="ltr"')
helpers.locale_html(testfield)
eq_(s, ' lang="%s" dir="rtl"' % testfield.locale)
test_locale_html_xss()
Mock()
alert(1)
helpers.locale_html(testfield)
alert(1)
test_empty_locale_html()
helpers.locale_html(None)
test_truncate_purified_field()
PurifiedTranslation(localized_string=s)
jingo.env.from_string('{{ s|truncate(6)
render({'s': t})
eq_(actual, s)
test_truncate_purified_field_xss()
alert("omg")
PurifiedTranslation(localized_string=s)
jingo.env.from_string('{{ s|truncate(100)
render({'s': t})
eq_(actual, 'safe <script>alert("omg")
jingo.env.from_string('{{ s|truncate(5)
render({'s': t})
eq_(actual, 'safe ...')
test_clean()
eq_(helpers.clean(s)
test_clean_in_template()
eq_(jingo.env.from_string('{{ s|clean }}')
render({'s': s})
test_no_links()
eq_(jingo.env.from_string('{{ s|no_links }}')
render({'s': s})
eq_(jingo.env.from_string('{{ s|no_links }}')
render({'s': s})
eq_(jingo.env.from_string('{{ s|no_links }}')
render({'s': s})
test_l10n_menu()
helpers.l10n_menu({})
provided (eg for user)
helpers.l10n_menu({}, remove_locale_url='/some/url/')
helpers.l10n_menu({'addon': Addon()
patch.object(settings, 'AMO_LANGUAGES', ('de', 'en-US', 'es', 'fr', 'pt-BR')
TestAllLocales(amo.tests.TestCase)
test_all_locales_none(self)
eq_(helpers.all_locales(addon, field_name)
Mock()
eq_(helpers.all_locales(addon, field_name)
test_all_locales(self)
TranslatedModel()
save_signal(sender=TranslatedModel, instance=obj)
helpers.all_locales(obj, 'description')
test_all_locales_empty(self)
TranslatedModel()
save_signal(sender=TranslatedModel, instance=obj)
helpers.all_locales(obj, 'description')
helpers.all_locales(obj, 'description', prettify_empty=True)
Copyright (c)
WrapTests(unittest.TestCase)
setUp(self)
sampleText.split()
text.wordWrap(sampleText, self.lineWidth)
test_wordCount(self)
words.extend(line.split()
len(words)
len(self.sampleSplitText)
self.assertEqual(wordCount, sampleTextWordCount)
test_wordMatch(self)
words.extend(line.split()
self.assertTrue(self.sampleSplitText == words)
test_lineLength(self)
len(line)
failures.append(len(line)
len(failures)
len(self.output)
test_doubleNewline(self)
text.wordWrap(sampleText, self.lineWidth)
self.assertEqual(result, ["et", "", "phone home.", ""])
LineTests(unittest.TestCase)
test_isMultiline(self)