예제 #1
0
    def testCommonBadChars(self):
        """Tests that common bad characters are removed"""
        result = _sanitize('a@$#b!)(*$%&^c`/\\"\';:<>,d')

        self.assertEqual(
            'abcd',
            result
        )
예제 #2
0
    def testEmptyString(self):
        """Tests that sanitize will return and not choke on empty string"""
        result = _sanitize('')

        self.assertEqual(
            '',
            result
        )
예제 #3
0
    def testLeadingUnderscoreRemove(self):
        """Tests that leading underscores are removed"""
        result = _sanitize('_abc')

        self.assertEqual(
            'abc',
            result
        )
예제 #4
0
    def testLeadingPeriodRemove(self):
        """Tests that leading periods are removed"""
        result = _sanitize('.abc')

        self.assertEqual(
            'abc',
            result
        )
예제 #5
0
    def testPeriodsOkay(self):
        """Tests that periods pass through intact"""
        result = _sanitize('a.b.c')

        self.assertEqual(
            'a.b.c',
            result
        )
예제 #6
0
    def testUnderscoresOkay(self):
        """Tests that underscores pass through intact"""
        result = _sanitize('a_b_c')

        self.assertEqual(
            'a_b_c',
            result
        )
예제 #7
0
    def testSpaces(self):
        """Tests that spaces are replaced with underscores"""
        result = _sanitize('banana apple blueberry')

        self.assertEqual(
            'banana_apple_blueberry',
            result
        )
예제 #8
0
    def testEmptyString(self):
        """Tests that sanitize will return and not choke on empty string"""
        result = _sanitize('')

        self.assertEqual('', result)
예제 #9
0
    def testCommonBadChars(self):
        """Tests that common bad characters are removed"""
        result = _sanitize('a@$#b!)(*$%&^c`/\\"\';:<>,d')

        self.assertEqual('abcd', result)
예제 #10
0
    def testLeadingUnderscoreRemove(self):
        """Tests that leading underscores are removed"""
        result = _sanitize('_abc')

        self.assertEqual('abc', result)
예제 #11
0
    def testLeadingPeriodRemove(self):
        """Tests that leading periods are removed"""
        result = _sanitize('.abc')

        self.assertEqual('abc', result)
예제 #12
0
    def testPeriodsOkay(self):
        """Tests that periods pass through intact"""
        result = _sanitize('a.b.c')

        self.assertEqual('a.b.c', result)
예제 #13
0
    def testUnderscoresOkay(self):
        """Tests that underscores pass through intact"""
        result = _sanitize('a_b_c')

        self.assertEqual('a_b_c', result)
예제 #14
0
    def testSpaces(self):
        """Tests that spaces are replaced with underscores"""
        result = _sanitize('banana apple blueberry')

        self.assertEqual('banana_apple_blueberry', result)