summaryrefslogtreecommitdiff
path: root/testsuite/test_util.py
blob: 075b163c97b82b04e40ac137f49d03a9b90edec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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):
        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'),
            [os.path.realpath('/foo/bar'), os.path.abspath('bat')],
        )
        self.assertEqual(
            normalize_paths(".pyc,\n   build/*"),
            ['.pyc', os.path.abspath('build/*')],
        )