def test_sanitize_filename(self):
    self.assertEqual(sanitize_filename(''), '')
    self.assertEqual(sanitize_filename('abc'), 'abc')
    self.assertEqual(sanitize_filename('abc_d-e'), 'abc_d-e')
    self.assertEqual(sanitize_filename('123'), '123')
    self.assertEqual('abc_de', sanitize_filename('abc/de'))
    self.assertFalse(('/' in sanitize_filename('abc/de///')))
    self.assertEqual('abc_de', sanitize_filename('abc/<>\\*|de'))
    self.assertEqual('xxx', sanitize_filename('xxx/<>\\*|'))
    self.assertEqual('yes no', sanitize_filename('yes? no'))
    self.assertEqual('this - that', sanitize_filename('this: that'))
    self.assertEqual(sanitize_filename('AT&T'), 'AT&T')
    aumlaut = 'ä'
    self.assertEqual(sanitize_filename(aumlaut), aumlaut)
    tests = 'кириллица'
    self.assertEqual(sanitize_filename(tests), tests)
    self.assertEqual(sanitize_filename('New World record at 0:12:34'), 'New World record at 0_12_34')
    self.assertEqual(sanitize_filename('--gasdgf'), '--gasdgf')
    self.assertEqual(sanitize_filename('--gasdgf', is_id=True), '--gasdgf')
    self.assertEqual(sanitize_filename('--gasdgf', is_id=False), '_-gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf'), '.gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf', is_id=True), '.gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf', is_id=False), 'gasdgf')
    forbidden = '"\x00\\/'
    for fc in forbidden:
        for fbc in forbidden:
            self.assertTrue((fbc not in sanitize_filename(fc)))
def test_sanitize_filename(self):
    self.assertEqual(sanitize_filename(), )
    self.assertEqual(sanitize_filename('abc'), 'abc')
    self.assertEqual(sanitize_filename('abc_d-e'), 'abc_d-e')
    self.assertEqual(sanitize_filename('123'), '123')
    self.assertEqual('abc_de', sanitize_filename('abc/de'))
    self.assertFalse(('/' in sanitize_filename('abc/de///')))
    self.assertEqual('abc_de', sanitize_filename('abc/<>\\*|de'))
    self.assertEqual('xxx', sanitize_filename('xxx/<>\\*|'))
    self.assertEqual('yes no', sanitize_filename('yes? no'))
    self.assertEqual('this - that', sanitize_filename('this: that'))
    self.assertEqual(sanitize_filename('AT&T'), 'AT&T')
    aumlaut = 'ä'
    self.assertEqual(sanitize_filename(aumlaut), aumlaut)
    tests = 'кириллица'
    self.assertEqual(sanitize_filename(tests), tests)
    self.assertEqual(sanitize_filename('New World record at 0:12:34'), 'New World record at 0_12_34')
    self.assertEqual(sanitize_filename('--gasdgf'), '--gasdgf')
    self.assertEqual(sanitize_filename('--gasdgf', is_id=True), '--gasdgf')
    self.assertEqual(sanitize_filename('--gasdgf', is_id=False), '_-gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf'), '.gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf', is_id=True), '.gasdgf')
    self.assertEqual(sanitize_filename('.gasdgf', is_id=False), 'gasdgf')
    forbidden = '"\x00\\/'
    for fc in forbidden:
        for fbc in forbidden:
            self.assertTrue((fbc not in sanitize_filename(fc)))