예제 #1
0
def test_format_fname():
    # test_builtin
    assert format_fname('{a}') == '{a}'

    # test_relpath
    val = '.' + os.path.sep + 'foo'
    assert format_fname(val) == val

    # test_unknown
    val = '..' + os.path.sep + 'foo'
    assert format_fname(val) == './../foo'.replace('/', os.path.sep)
예제 #2
0
    def test_format_fname(self):
        # test_builtin
        self.assertEqual(format_fname("{a}"), "{a}")

        # test_relpath
        val = "." + os.path.sep + "foo"
        self.assertEqual(format_fname(val), val)

        # test_unknown
        val = ".." + os.path.sep + "foo"
        self.assertEqual(format_fname(val), "./../foo".replace("/", os.path.sep))
    def test_format_fname(self):
        # test_builtin
        self.assertEqual(format_fname('{a}'), '{a}')

        # test_relpath
        val = '.' + os.path.sep + 'foo'
        self.assertEqual(format_fname(val), val)

        # test_unknown
        val = '..' + os.path.sep + 'foo'
        self.assertEqual(format_fname(val),
                         './../foo'.replace('/', os.path.sep))
예제 #4
0
    def test_format_fname(self):
        # test_builtin
        self.assertEqual(format_fname('{a}'), '{a}')

        # test_relpath
        val = '.' + os.path.sep + 'foo'
        self.assertEqual(format_fname(val), val)

        # test_unknown
        val = '..' + os.path.sep + 'foo'
        self.assertEqual(format_fname(val),
                         './../foo'.replace('/', os.path.sep))
    def test_module_file_path(self):
        sys_path = [
            '/foo/',
            '/foo/bar',
            '/usr/local/python/site-packages/',
        ]

        sys_path = map(lambda path: path.replace('/', os.path.sep), sys_path)
        modpath = format_fname(
            '/foo/bar/pyramid_debugtoolbar/tests/debugfoo.py'.replace(
                '/', os.path.sep), sys_path)
        self.assertEqual(modpath,
                         '<pyramid_debugtoolbar/tests/debugfoo.py>'.replace(
                             '/', os.path.sep))
예제 #6
0
def test_module_file_path():
    sys_path = [
        '/foo/',
        '/foo/bar',
        '/usr/local/python/site-packages/',
    ]

    sys_path = map(lambda path: path.replace('/', os.path.sep), sys_path)
    modpath = format_fname(
        '/foo/bar/aiohttp_debugtoolbar/tests/debugfoo.py'.replace(
            '/', os.path.sep), sys_path)
    expected = '<aiohttp_debugtoolbar/tests/debugfoo.py>'.replace(
        '/', os.path.sep)
    assert modpath == expected
예제 #7
0
 def test_no_matching_sys_path(self):
     val = "/foo/bar/aiohttp_debugtoolbar/foo.py"
     sys_path = ["/bar/baz"]
     self.assertEqual(format_fname(val, sys_path), "</foo/bar/aiohttp_debugtoolbar/foo.py>")
예제 #8
0
    def test_module_file_path(self):
        sys_path = ["/foo/", "/foo/bar", "/usr/local/python/site-packages/"]

        sys_path = map(lambda path: path.replace("/", os.path.sep), sys_path)
        modpath = format_fname("/foo/bar/aiohttp_debugtoolbar/tests/debugfoo.py".replace("/", os.path.sep), sys_path)
        self.assertEqual(modpath, "<aiohttp_debugtoolbar/tests/debugfoo.py>".replace("/", os.path.sep))
 def test_no_matching_sys_path(self):
     val = '/foo/bar/pyramid_debugtoolbar/foo.py'
     sys_path = ['/bar/baz']
     self.assertEqual(format_fname(val, sys_path),
                      '</foo/bar/pyramid_debugtoolbar/foo.py>')
예제 #10
0
def test_no_matching_sys_path():
    val = '/foo/bar/aiohttp_debugtoolbar/foo.py'
    sys_path = ['/bar/baz']
    expected = '</foo/bar/aiohttp_debugtoolbar/foo.py>'
    assert format_fname(val, sys_path) == expected
예제 #11
0
 def test_no_matching_sys_path(self):
     val = '/foo/bar/aiohttp_debugtoolbar/foo.py'
     sys_path = ['/bar/baz']
     self.assertEqual(format_fname(val, sys_path),
                      '</foo/bar/aiohttp_debugtoolbar/foo.py>')