# Path: pydoop/hdfs/common.py
# DEFAULT_PORT = 8020  # org/apache/hadoop/hdfs/server/namenode/NameNode.java
# 
# DEFAULT_USER = getpass.getuser()
# 
# Path: pydoop/test_utils.py
# UNI_CHR = _get_special_chr()


import os
import unittest
import tempfile
import pydoop.hdfs as hdfs
from numbers import Number
from pydoop.hdfs.common import DEFAULT_PORT, DEFAULT_USER
from pydoop.utils.misc import make_random_str
from pydoop.test_utils import UNI_CHR
            ('file:///a/b', ('', 0, '/a/b')),
            ('file:/a/b', ('', 0, '/a/b')),
            ('file:///a', ('', 0, '/a')),
            ('file:/a', ('', 0, '/a')),
            ('file://temp/foo.txt', ('', 0, 'temp/foo.txt')),
            ('file://temp', ('', 0, 'temp')),
        ]
        if hdfs.default_is_local():
            cases.extend([
                ('///a/b', ('', 0, '/a/b')),
                ('/a/b', ('', 0, '/a/b')),
                ('a/b', ('', 0, 'a/b')),
            ])
        else:
            cases.extend([
                ('///a/b', ('default', 0, '/a/b')),
                ('/a/b', ('default', 0, '/a/b')),
                ('a/b', ('default', 0, '/user/%s/a/b' % DEFAULT_USER)),
            ])
        for p, r in cases:
            self.assertEqual(hdfs.path.split(p), r)
        for p, r in cases[1:]:
            self.assertEqual(hdfs.path.split(p + UNI_CHR), uni_last(r))

    def good_with_user(self):
        if hdfs.default_is_local():
            cases = [
                ('a/b', u, ('', 0, 'a/b')) for u in [None, DEFAULT_USER, 'foo']
            ]
        else:

# Path: pydoop/hdfs/common.py
# DEFAULT_PORT = 8020  # org/apache/hadoop/hdfs/server/namenode/NameNode.java
# 
# DEFAULT_USER = getpass.getuser()
# 
# Path: pydoop/test_utils.py
# UNI_CHR = _get_special_chr()


# Path: test/hdfs/test_path.py
import os
import unittest
import tempfile
import pydoop.hdfs as hdfs
from numbers import Number
from pydoop.hdfs.common import DEFAULT_PORT, DEFAULT_USER
from pydoop.utils.misc import make_random_str
from pydoop.test_utils import UNI_CHR

            ('file:///a/b', ('', 0, '/a/b')),
            ('file:/a/b', ('', 0, '/a/b')),
            ('file:///a', ('', 0, '/a')),
            ('file:/a', ('', 0, '/a')),
            ('file://temp/foo.txt', ('', 0, 'temp/foo.txt')),
            ('file://temp', ('', 0, 'temp')),
        ]
        if hdfs.default_is_local():
            cases.extend([
                ('///a/b', ('', 0, '/a/b')),
                ('/a/b', ('', 0, '/a/b')),
                ('a/b', ('', 0, 'a/b')),
            ])
        else:
            cases.extend([
                ('///a/b', ('default', 0, '/a/b')),
                ('/a/b', ('default', 0, '/a/b')),
                ('a/b', ('default', 0, '/user/%s/a/b' % DEFAULT_USER)),
            ])
        for p, r in cases:
            self.assertEqual(hdfs.path.split(p), r)
        for p, r in cases[1:]:
            self.assertEqual(hdfs.path.split(p + UNI_CHR), uni_last(r))

    def good_with_user(self):
        if hdfs.default_is_local():
            cases = [
                ('a/b', u, ('', 0, 'a/b')) for u in [None, DEFAULT_USER, 'foo']
            ]
        else:

            cases = [