class TestNormalizeCommandRunner(object):
    def setup_method(self, method):
        self.n = NormalizeCommandRunner()

    def test_strips_digits_at_start(self):
        self.n.run(Command('normalize', '42blah')) == (True, 'blah')

    def test_replaces_bad_chars_with_underscores(self):
        bad_string = '-+\\|()[]{}<>,./:\'" \t;`!@#$%^&*'
        self.n.run(Command('normalize', bad_string)) == (True, '_' * len(bad_string))
Beispiel #2
0
class TestNormalizeCommandRunner(object):
    def setup_method(self, method):
        self.n = NormalizeCommandRunner()

    def test_strips_digits_at_start(self):
        self.n.run(Command('normalize', '42blah')) == (True, 'blah')

    def test_replaces_bad_chars_with_underscores(self):
        bad_string = '-+\\|()[]{}<>,./:\'" \t;`!@#$%^&*'
        self.n.run(Command('normalize',
                           bad_string)) == (True, '_' * len(bad_string))
class TestNormalizeCommandRunner(object):
    def setup_method(self, method):
        self.n = NormalizeCommandRunner()

    def test_strips_digits_at_start(self):
        self.n.run(Command('normalize', '42blah')) == (True, 'blah')

    def test_replaces_bad_chars_with_underscores(self):
        bad_string = '-+\\|()[]{}<>,./:\'" \t;`!@#$%^&*'
        self.n.run(Command('normalize', bad_string)) == (True, '_' * len(bad_string))

    def test_unicode_chars(self):
        s = 'ěšč'
        assert self.n.run(Command('normalize', s)) == (True, 'esc')
        s = u'ěšč'
        assert self.n.run(Command('normalize', s)) == (True, 'esc')

    def test_ok_chars(self):
        i = {'what': 'foo-bar.+*', 'ok_chars': '-.'}
        assert self.n.run(Command('normalize', i)) == (True, 'foo-bar.__')
Beispiel #4
0
 def setup_method(self, method):
     self.n = NormalizeCommandRunner()
 def setup_method(self, method):
     self.n = NormalizeCommandRunner()