Commits

holger krekel  committed 45b8980

introduce a dirname attribute to path objects

  • Participants
  • Parent commits 95f4053

Comments (0)

Files changed (3)

 - use apipkg-1.1 and make py.apipkg.initpkg|ApiModule available
 - add py.iniconfig module for brain-dead easy ini-config file parsing
 - introduce py.builtin.any()
+- path objects have a .dirname attribute now
 
 Changes between 1.3.3 and 1.3.4
 ==================================================

File py/_path/common.py

         return self._getbyspec('basename')[0]
     basename = property(basename, None, None, basename.__doc__)
 
+    def dirname(self):
+        """ dirname part of path. """
+        return self._getbyspec('dirname')[0]
+    dirname = property(dirname, None, None, dirname.__doc__)
+
     def purebasename(self):
         """ pure base name of the path."""
         return self._getbyspec('purebasename')[0]

File testing/path/common.py

         assert newpath.check(basename='sampledir')
         assert newpath.basename, 'sampledir'
 
+    def test_dirname(self, path1):
+        newpath = path1.join('sampledir')
+        assert newpath.dirname == str(path1)
+
     def test_dirpath(self, path1):
         newpath = path1.join('sampledir')
         assert newpath.dirpath() == path1