Ejemplo n.º 1
0
 def test_parts(self):
     """Tests parent, ancestor, name, stem, ext."""
     relative = WindowsPath(u'directory/users\\r\xE9mi/file.txt')
     absolute = WindowsPath(u'\\some/other\\thing.h\xE9h\xE9')
     self.assertEqual(relative.parent.path, u'directory\\users\\r\xE9mi')
     self.assertEqual(absolute.parent.path, u'\\some\\other')
     self.assertEqual(absolute.ancestor(10).path, u'\\')
     self.assertEqual(relative.name, u'file.txt')
     self.assertEqual(absolute.name, u'thing.h\xE9h\xE9')
     self.assertEqual(absolute.unicodename, u'thing.h\xE9h\xE9')
     self.assertEqual(absolute.stem, u'thing')
     self.assertEqual(absolute.ext, u'.h\xE9h\xE9')
Ejemplo n.º 2
0
 def test_parts(self):
     """Tests parent, ancestor, name, stem, ext."""
     relative = WindowsPath(u'directory/users\\r\xE9mi/file.txt')
     absolute = WindowsPath(u'\\some/other\\thing.h\xE9h\xE9')
     self.assertEqual(relative.parent.path,
                      u'directory\\users\\r\xE9mi')
     self.assertEqual(absolute.parent.path,
                      u'\\some\\other')
     self.assertEqual(absolute.ancestor(10).path,
                      u'\\')
     self.assertEqual(relative.name, u'file.txt')
     self.assertEqual(absolute.name, u'thing.h\xE9h\xE9')
     self.assertEqual(absolute.unicodename, u'thing.h\xE9h\xE9')
     self.assertEqual(absolute.stem, u'thing')
     self.assertEqual(absolute.ext, u'.h\xE9h\xE9')
Ejemplo n.º 3
0
 def test_parts(self):
     """Tests parent, ancestor, name, stem, ext."""
     relative = WindowsPath('directory/users\\r\xE9mi/file.txt')
     absolute = WindowsPath('\\some/other\\thing.h\xE9h\xE9')
     self.assertEqual(relative.parent.path,
                      'directory\\users\\r\xE9mi')
     self.assertEqual(absolute.parent.path,
                      '\\some\\other')
     self.assertEqual(absolute.ancestor(10).path,
                      '\\')
     self.assertEqual(relative.name, 'file.txt')
     self.assertEqual(absolute.name, 'thing.h\xE9h\xE9')
     self.assertEqual(absolute.unicodename, 'thing.h\xE9h\xE9')
     self.assertEqual(absolute.stem, 'thing')
     self.assertEqual(absolute.ext, '.h\xE9h\xE9')
     self.assertEqual(relative._components(),
                      ['directory', 'users', 'r\xE9mi', 'file.txt'])
     self.assertEqual(absolute._components(),
                      ['\\', 'some', 'other', 'thing.h\xE9h\xE9'])