summaryrefslogtreecommitdiff
path: root/testsuite/test_util.py
blob: 8eaba7efc4fb088359a3c8bfe3f20a69e5ccb670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest

from pycodestyle import normalize_paths


class UtilTestCase(unittest.TestCase):
    def test_normalize_paths(self):
        cwd = os.getcwd()

        self.assertEqual(normalize_paths(''), [])
        self.assertEqual(normalize_paths([]), [])
        self.assertEqual(normalize_paths(None), [])
        self.assertEqual(normalize_paths(['foo']), ['foo'])
        self.assertEqual(normalize_paths('foo'), ['foo'])
        self.assertEqual(normalize_paths('foo,bar'), ['foo', 'bar'])
        self.assertEqual(normalize_paths('foo,  bar  '), ['foo', 'bar'])
        self.assertEqual(normalize_paths('/foo/bar,baz/../bat'),
                         ['/foo/bar', cwd + '/bat'])
        self.assertEqual(normalize_paths(".pyc,\n   build/*"),
                         ['.pyc', cwd + '/build/*'])