Commits

holger krekel committed 507fd99

fix issue35 - define __gt__ ordering between a local path and strings

Comments (0)

Files changed (5)

+Changes between 1.4.15 and 1.4.16.dev
+==================================================
+
+- fix issue35 - define __gt__ ordering between a local path
+  and strings
+
 Changes between 1.4.14 and 1.4.15
 ==================================================
 
 
 (c) Holger Krekel and others, 2004-2013
 """
-__version__ = '1.4.15'
+__version__ = '1.4.16.dev1'
 
 from py import _apipkg
 

py/_path/local.py

     def __lt__(self, other):
         return str(self) < str(other)
 
+    def __gt__(self, other):
+        return str(self) > str(other)
+
     def samefile(self, other):
         """ return True if 'other' references the same file as 'self'.
         """
         name='py',
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.15',
+        version='1.4.16.dev1',
         url='http://pylib.readthedocs.org/',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/path/test_local.py

         assert path3 != path2
         assert path2 != path3
 
+    def test_gt_with_strings(self, path1):
+        path2 = path1.join('sampledir')
+        path3 = str(path1.join("ttt"))
+        assert path3 > path2
+        assert path2 < path3
+        assert path2 < "ttt"
+        assert "ttt" > path2
+        path4 = path1.join("aaa")
+        l = [path2, path4,path3]
+        assert sorted(l) == [path4, path2, path3]
+
     @py.test.mark.multi(bin=(False, True))
     def test_dump(self, tmpdir, bin):
         path = tmpdir.join("dumpfile%s" % int(bin))