def testCommonBadChars(self): """Tests that common bad characters are removed""" result = _sanitize('a@$#b!)(*$%&^c`/\\"\';:<>,d') self.assertEqual( 'abcd', result )
def testEmptyString(self): """Tests that sanitize will return and not choke on empty string""" result = _sanitize('') self.assertEqual( '', result )
def testLeadingUnderscoreRemove(self): """Tests that leading underscores are removed""" result = _sanitize('_abc') self.assertEqual( 'abc', result )
def testLeadingPeriodRemove(self): """Tests that leading periods are removed""" result = _sanitize('.abc') self.assertEqual( 'abc', result )
def testPeriodsOkay(self): """Tests that periods pass through intact""" result = _sanitize('a.b.c') self.assertEqual( 'a.b.c', result )
def testUnderscoresOkay(self): """Tests that underscores pass through intact""" result = _sanitize('a_b_c') self.assertEqual( 'a_b_c', result )
def testSpaces(self): """Tests that spaces are replaced with underscores""" result = _sanitize('banana apple blueberry') self.assertEqual( 'banana_apple_blueberry', result )
def testEmptyString(self): """Tests that sanitize will return and not choke on empty string""" result = _sanitize('') self.assertEqual('', result)
def testCommonBadChars(self): """Tests that common bad characters are removed""" result = _sanitize('a@$#b!)(*$%&^c`/\\"\';:<>,d') self.assertEqual('abcd', result)
def testLeadingUnderscoreRemove(self): """Tests that leading underscores are removed""" result = _sanitize('_abc') self.assertEqual('abc', result)
def testLeadingPeriodRemove(self): """Tests that leading periods are removed""" result = _sanitize('.abc') self.assertEqual('abc', result)
def testPeriodsOkay(self): """Tests that periods pass through intact""" result = _sanitize('a.b.c') self.assertEqual('a.b.c', result)
def testUnderscoresOkay(self): """Tests that underscores pass through intact""" result = _sanitize('a_b_c') self.assertEqual('a_b_c', result)
def testSpaces(self): """Tests that spaces are replaced with underscores""" result = _sanitize('banana apple blueberry') self.assertEqual('banana_apple_blueberry', result)