Exemplo n.º 1
0
    def testCommonBadChars(self):
        """Tests that common bad characters are removed"""
        result = cdl_convert._sanitize('[email protected]$#b!)(*$%&^c`/\\"\';:<>,d')

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

        self.assertEqual(
            '',
            result
        )
Exemplo n.º 3
0
    def testLeadingUnderscoreRemove(self):
        """Tests that leading underscores are removed"""
        result = cdl_convert._sanitize('_abc')

        self.assertEqual(
            'abc',
            result
        )
Exemplo n.º 4
0
    def testLeadingPeriodRemove(self):
        """Tests that leading periods are removed"""
        result = cdl_convert._sanitize('.abc')

        self.assertEqual(
            'abc',
            result
        )
Exemplo n.º 5
0
    def testPeriodsOkay(self):
        """Tests that periods pass through intact"""
        result = cdl_convert._sanitize('a.b.c')

        self.assertEqual(
            'a.b.c',
            result
        )
Exemplo n.º 6
0
    def testUnderscoresOkay(self):
        """Tests that underscores pass through intact"""
        result = cdl_convert._sanitize('a_b_c')

        self.assertEqual(
            'a_b_c',
            result
        )
Exemplo n.º 7
0
    def testSpaces(self):
        """Tests that spaces are replaced with underscores"""
        result = cdl_convert._sanitize('banana apple blueberry')

        self.assertEqual(
            'banana_apple_blueberry',
            result
        )