Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_empty(self):
self.assertEqual(None, slugify(None))
self.assertEqual(None, ascii_text(None))
self.assertEqual(None, latinize_text(None))
self.assertEqual(None, normalize(None))
self.assertEqual(None, normalize(''))
self.assertEqual(None, normalize(' '))
def test_ahmad(self):
text = u'əhməd'
self.assertEqual('ahmad', ascii_text(text))
def test_empty(self):
self.assertEqual(None, slugify(None))
self.assertEqual(None, ascii_text(None))
self.assertEqual(None, latinize_text(None))
self.assertEqual(None, normalize(None))
self.assertEqual(None, normalize(''))
self.assertEqual(None, normalize(' '))
def test_azeri(self):
text = u'FUAD ALIYEV ƏHMƏD OĞLU'
self.assertEqual('FUAD ALIYEV AHMAD OGLU', ascii_text(text))
def test_safe_filename(self):
self.assertEqual(None, safe_filename(None))
self.assertEqual('test.txt', safe_filename('test.txt'))
self.assertEqual('test.txt', safe_filename('test .txt'))
self.assertEqual('test_bla.txt', safe_filename('test bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test_bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test.bla.txt'))
self.assertEqual('test.txt', safe_filename('test', extension='txt'))
def test_safe_filename(self):
self.assertEqual(None, safe_filename(None))
self.assertEqual('test.txt', safe_filename('test.txt'))
self.assertEqual('test.txt', safe_filename('test .txt'))
self.assertEqual('test_bla.txt', safe_filename('test bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test_bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test.bla.txt'))
self.assertEqual('test.txt', safe_filename('test', extension='txt'))
def test_long_filename(self):
long_name = ['long name'] * 100
long_name = '-'.join(long_name)
shortened = safe_filename(long_name)
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename(long_name, extension='html')
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename('bla', extension=long_name)
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename(long_name, extension=long_name)
assert len(shortened) <= MAX_LENGTH, shortened
def test_safe_filename(self):
self.assertEqual(None, safe_filename(None))
self.assertEqual('test.txt', safe_filename('test.txt'))
self.assertEqual('test.txt', safe_filename('test .txt'))
self.assertEqual('test_bla.txt', safe_filename('test bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test_bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test.bla.txt'))
self.assertEqual('test.txt', safe_filename('test', extension='txt'))
def test_long_filename(self):
long_name = ['long name'] * 100
long_name = '-'.join(long_name)
shortened = safe_filename(long_name)
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename(long_name, extension='html')
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename('bla', extension=long_name)
assert len(shortened) <= MAX_LENGTH, shortened
shortened = safe_filename(long_name, extension=long_name)
assert len(shortened) <= MAX_LENGTH, shortened
def test_safe_filename(self):
self.assertEqual(None, safe_filename(None))
self.assertEqual('test.txt', safe_filename('test.txt'))
self.assertEqual('test.txt', safe_filename('test .txt'))
self.assertEqual('test_bla.txt', safe_filename('test bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test_bla.txt'))
self.assertEqual('test_bla.txt', safe_filename('test.bla.txt'))
self.assertEqual('test.txt', safe_filename('test', extension='txt'))