# 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
        self.__check_join(
            [(('/foo', 'bar', UNI_CHR), '/foo/bar/%s' % UNI_CHR)]
        )


class TestAbspath(unittest.TestCase):

    def setUp(self):
        if hdfs.default_is_local():
            self.root = "file:"
        else:
            fs = hdfs.hdfs("default", 0)
            self.root = "hdfs://%s:%s" % (fs.host, fs.port)
            fs.close()
        self.p = 'a/%s' % UNI_CHR

    def without_user(self):
        abs_p = hdfs.path.abspath(self.p, user=None, local=False)
        if hdfs.default_is_local():
            self.assertEqual(
                abs_p, '%s%s' % (self.root, os.path.abspath(self.p))
            )
        else:
            self.assertEqual(
                abs_p, '%s/user/%s/%s' % (self.root, DEFAULT_USER, self.p)
            )

    def with_user(self):
        abs_p = hdfs.path.abspath(self.p, user="pydoop", local=False)
        if hdfs.default_is_local():

# 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

        self.__check_join(
            [(('/foo', 'bar', UNI_CHR), '/foo/bar/%s' % UNI_CHR)]
        )


class TestAbspath(unittest.TestCase):

    def setUp(self):
        if hdfs.default_is_local():
            self.root = "file:"
        else:
            fs = hdfs.hdfs("default", 0)
            self.root = "hdfs://%s:%s" % (fs.host, fs.port)
            fs.close()
        self.p = 'a/%s' % UNI_CHR

    def without_user(self):
        abs_p = hdfs.path.abspath(self.p, user=None, local=False)
        if hdfs.default_is_local():
            self.assertEqual(
                abs_p, '%s%s' % (self.root, os.path.abspath(self.p))
            )
        else:
            self.assertEqual(
                abs_p, '%s/user/%s/%s' % (self.root, DEFAULT_USER, self.p)
            )

    def with_user(self):
        abs_p = hdfs.path.abspath(self.p, user="pydoop", local=False)
        if hdfs.default_is_local():

            self.assertEqual(