예제 #1
0
파일: test_uri.py 프로젝트: zendbit/peppy
 def test_pathto_w_slash(self):
     before = Path('/a/b/')
     after = Path('/a/b/c')
     self.assertEqual(before.get_pathto(after), 'c')
     before = Path('u/a/\u03A0/')
     after = Path('u/a/\u03A0/c')
     self.assertEqual(before.get_pathto(after), u'c')
예제 #2
0
파일: test_uri.py 프로젝트: betsegaw/peppy
 def test_pathto_w_slash(self):
     before = Path('/a/b/')
     after = Path('/a/b/c')
     self.assertEqual(before.get_pathto(after), 'c')
     before = Path('u/a/\u03A0/')
     after = Path('u/a/\u03A0/c')
     self.assertEqual(before.get_pathto(after), u'c')
예제 #3
0
파일: test_uri.py 프로젝트: zendbit/peppy
class PathComparisonTestCase(unittest.TestCase):
    def setUp(self):
        self.path_wo_slash = Path('/a/b/c')
        self.path_w_slash = Path('/a/b/c/')
        self.wo_to_w = self.path_wo_slash.get_pathto(self.path_w_slash)
        self.conversion = str

    #########################################################################
    # Comparing Path objects
    def test_with_eq_without_trailing_slash(self):
        """A path is not the same with a trailing slash."""
        self.assertNotEqual(self.path_wo_slash, self.path_w_slash)

    def test_wo_to_w_eq_path_dot(self):
        """The path to the same with a trailing slash returns Path('.')."""
        self.assertEqual(self.wo_to_w, Path('.'))

    #########################################################################
    # Comparing with string conversions.
    def test_path_wo_slash_eq_string(self):
        """A path without trailing slash equals its string conversion."""
        self.assertEqual(self.path_wo_slash,
                         self.conversion(self.path_wo_slash))

    def test_path_w_slash_eq_string(self):
        """A path with trailing slash equals its string conversion."""
        self.assertEqual(self.path_w_slash, self.conversion(self.path_w_slash))

    def test_path_to_similar_eq_string_dot(self):
        """The path to the same with a trailing slash equals '.'."""
        self.assertEqual(self.wo_to_w, '.')

    def test_absolute(self):
        self.assert_(self.path_w_slash.is_absolute())
        self.assert_(self.path_wo_slash.is_absolute())
예제 #4
0
파일: test_uri.py 프로젝트: betsegaw/peppy
class UnicodePathComparisonTestCase(PathComparisonTestCase):

    def setUp(self):
        self.path_wo_slash = Path(u'/a/\u03A0/c')
        self.path_w_slash = Path(u'/a/\u03A0/c/')
        self.wo_to_w = self.path_wo_slash.get_pathto(self.path_w_slash)
        self.conversion = unicode
예제 #5
0
파일: test_uri.py 프로젝트: betsegaw/peppy
class PathComparisonTestCase(unittest.TestCase):

    def setUp(self):
        self.path_wo_slash = Path('/a/b/c')
        self.path_w_slash = Path('/a/b/c/')
        self.wo_to_w = self.path_wo_slash.get_pathto(self.path_w_slash)
        self.conversion = str


    #########################################################################
    # Comparing Path objects
    def test_with_eq_without_trailing_slash(self):
        """A path is not the same with a trailing slash."""
        self.assertNotEqual(self.path_wo_slash, self.path_w_slash)


    def test_wo_to_w_eq_path_dot(self):
        """The path to the same with a trailing slash returns Path('.')."""
        self.assertEqual(self.wo_to_w, Path('.'))


    #########################################################################
    # Comparing with string conversions.
    def test_path_wo_slash_eq_string(self):
        """A path without trailing slash equals its string conversion."""
        self.assertEqual(self.path_wo_slash, self.conversion(self.path_wo_slash))


    def test_path_w_slash_eq_string(self):
        """A path with trailing slash equals its string conversion."""
        self.assertEqual(self.path_w_slash, self.conversion(self.path_w_slash))


    def test_path_to_similar_eq_string_dot(self):
        """The path to the same with a trailing slash equals '.'."""
        self.assertEqual(self.wo_to_w, '.')

    def test_absolute(self):
        self.assert_(self.path_w_slash.is_absolute())
        self.assert_(self.path_wo_slash.is_absolute())
예제 #6
0
파일: test_uri.py 프로젝트: zendbit/peppy
class UnicodePathComparisonTestCase(PathComparisonTestCase):
    def setUp(self):
        self.path_wo_slash = Path(u'/a/\u03A0/c')
        self.path_w_slash = Path(u'/a/\u03A0/c/')
        self.wo_to_w = self.path_wo_slash.get_pathto(self.path_w_slash)
        self.conversion = unicode