lowks avatar lowks committed 8d25480

Making a few changes to enhpath_test.py to make it pep8 compliant

Comments (0)

Files changed (1)

rex/path/enhpath_test.py

 #!/usr/bin/env python
+# -*- coding: utf8 -*-
 """A test suite for enhpath.py.
    Run using py.test from http://codespeak.net/py/current/doc/test.html
 """
-import os, tempfile
+import os
+import tempfile
 import py.test
 from enhpath import path
 
 P2 = "aaa/bbb"
 P3 = "aaa/bbb/ccc.txt"
 
+
 def test_constructors():
     assert str(path(P1)) == P1
-    assert str(path(P2)) == P2 
-    assert str(path(P3)) == P3 
+    assert str(path(P2)) == P2
+    assert str(path(P3)) == P3
     assert str(path('')) == ''
-    assert str(path())   == '' 
+    assert str(path()) == ''
     assert str(path.cwd()) == os.getcwd()
 
+
 def test_tempfile():
     path.tempfile()
     path.tempdir()
     assert isinstance(path.tempfileobject(), file)
 
+
 def test_chdir():
     orig_dirs = path.pushed_dirs[:]
     origin = path(os.getcwd())
         assert path.pushed_dirs == orig_dirs
     finally:
         os.rmdir(tmp)
-    
+
+
 def test_repr():
     p = path(P1)
     assert repr(p) == "path(%r)" % P1
     path.repr_as_str = False
     assert repr(p) == "path(%r)" % P1
 
+
 def test_attributes():
     p = path(P3)
     assert p.parent == path('aaa/bbb')
     assert p.base == 'ccc'
     assert p.ext == '.txt'
 
+
 def test_operators():
     a = "aaa"
     b = "bbb"
     assert path(a) + path(b) == "aaabbb"
     assert path(a) / path(b) == os.path.join(a, b)
 
+
 def test_normalization():
     cwd = os.getcwd()
     p = path(P3)
     # Skipping .normcase(), .normpath() and .realpath()
     # Skipping .expand*(), .relpathto()
 
+
 def test_derivation():
     p = path(P3)
     ap = '/' + p
     assert p.splitpath() == [
-        path(''),  'aaa', 'bbb', 'ccc.txt']
+        path(''), 'aaa', 'bbb', 'ccc.txt']
     assert ap.splitpath() == [
         path('/'), 'aaa', 'bbb', 'ccc.txt']
     assert p.splitext() == (path('aaa/bbb/ccc'), '.txt')
     assert p.joinancestor(3, 'foo') == path('foo')
     # Skipping .redeploy()
 
+
 def test_relpathto():
     p = path('/home/joe/Mail')
     ancestor = path('/home/joe')
     assert p.relpathfrom(ancestor) == path('Mail')
     py.test.raises(ValueError, p.relpathfrom, bad_ancestor)
 
+
 def test_listing():
     dir = path.tempdir()
     a = dir / 'a'
     finally:
         dir.delete_dammit()
 
+
 def test_walk():
     dir = path.tempdir()
     a = dir / 'a'
         for p in a_files + b_files:
             p.touch()
         assert dir.listdir() == [a, b]
-        assert list(dir.walk()) == [a] + a_files + [b] + b_files 
+        assert list(dir.walk()) == [a] + a_files + [b] + b_files
         assert list(dir.walkdirs()) == [a, b]
         assert list(dir.walkfiles()) == a_files + b_files
     finally:
         dir.delete_dammit()
 
+
 def test_walk2():
     """A more complicated walk test."""
     #dir = path('/tmp/X');  dir.mkdir()  #path.tempdir()
     finally:
         dir.delete_dammit()
 
+
 def test_findpaths():
     #dir = path('/tmp/X');  dir.mkdir()  #path.tempdir()
     dir = path.tempdir()
         assert list(dir.walk()) == [a] + [subdir] + subfiles + [link] + \
             a_files + [b] + b_files
         assert dir.findpaths_pretend() == ['find', dir]
-        assert list(dir.findpaths()) == ([dir, a, subdir] + subfiles + 
-            [link] + a_files +  [b] + b_files)
+        assert list(dir.findpaths()) == ([dir, a, subdir] + subfiles +
+                                         [link] + a_files + [b] + b_files)
         assert list(b.findpaths()) == [b] + b_files
         dfp = dir.findpaths_pretend
         assert dfp(name='*') == ['find', dir, '-name', '*']
         assert dfp(name=('*.jpg', '*.png', '*.gif')) == \
             ['find', dir, '-lbrace', '-name', '*.jpg', '-or',
-            '-name', '*.png', '-or', '-name', '*.gif', '-rbrace']
+             '-name', '*.png', '-or', '-name', '*.gif', '-rbrace']
         assert dfp(maxdepth=1) == ['find', dir, '-maxdepth', '1']
         assert dfp(daystart=True) == ['find', dir, '-daystart']
         assert dfp(daystart=False) == ['find', dir]
         assert dfp('-type f') == dfp(['-type', 'f'])
     finally:
         dir.delete_dammit()
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.