summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2016-12-21 05:06:55 +0100
committernfnty <git@nfnty.se>2017-01-17 05:59:02 +0100
commitb3d031a913814900467358b2adf20a148bf6de1a (patch)
tree6f5b435817ec9cbe850fb73485a7e6c77da28c14 /tests
parent76791a70467d7223a966aa9f12f5583b01d704a8 (diff)
downloadranger-b3d031a913814900467358b2adf20a148bf6de1a.tar.gz
linting: pylint and flake8
Diffstat (limited to 'tests')
-rw-r--r--tests/ranger/container/test_bookmarks.py1
-rw-r--r--tests/ranger/container/test_container.py96
-rw-r--r--tests/ranger/container/test_fsobject.py11
3 files changed, 54 insertions, 54 deletions
diff --git a/tests/ranger/container/test_bookmarks.py b/tests/ranger/container/test_bookmarks.py
index a2cd446f..8107a71a 100644
--- a/tests/ranger/container/test_bookmarks.py
+++ b/tests/ranger/container/test_bookmarks.py
@@ -1,5 +1,6 @@
 import os
 import time
+
 import pytest
 
 from ranger.container.bookmarks import Bookmarks
diff --git a/tests/ranger/container/test_container.py b/tests/ranger/container/test_container.py
index 2b823912..7144236f 100644
--- a/tests/ranger/container/test_container.py
+++ b/tests/ranger/container/test_container.py
@@ -10,92 +10,92 @@ def testhistorybasic():
     # item added to it. It has a `current` index that serves as a cursor.
 
     # A history has a limited size, check that only `maxlen` items are stored
-    h = history.History(maxlen=10)
+    hist = history.History(maxlen=10)
     for entry in HISTORY_TEST_ENTRIES:
-        h.add(entry)
+        hist.add(entry)
 
     # 10 items are stored
-    assert len(h) == 10
-    assert h.current() == "19"
-    assert h.top() == "19"
-    assert h.bottom() == "10"
+    assert len(hist) == 10
+    assert hist.current() == "19"
+    assert hist.top() == "19"
+    assert hist.bottom() == "10"
 
     # going back in time affects only changes current item
-    h.back()
-    assert len(h) == 10
-    assert h.current() == "18"
-    assert h.top() == "19"
-    assert h.bottom() == "10"
+    hist.back()
+    assert len(hist) == 10
+    assert hist.current() == "18"
+    assert hist.top() == "19"
+    assert hist.bottom() == "10"
 
     # __iter__ is actually an interator and we can iterate through the list
-    it = iter(h)
-    assert iter(it) == it
-    assert list(it) == HISTORY_TEST_ENTRIES[10:]
+    iterator = iter(hist)
+    assert iter(iterator) == iterator
+    assert list(iterator) == HISTORY_TEST_ENTRIES[10:]
 
     # search allows to go back in time as long as a pattern matches and we don't
     # go over a step limit
-    assert h.search("45", -9) == "18"
-    assert h.search("1", -5) == "13"
+    assert hist.search("45", -9) == "18"
+    assert hist.search("1", -5) == "13"
 
     # fast forward selects the last item
-    h.fast_forward()
-    assert h.current() == "19"
+    hist.fast_forward()
+    assert hist.current() == "19"
 
     # back followed by forward is a noop
-    h.back()
-    h.forward()
-    assert h.current() == "19"
+    hist.back()
+    hist.forward()
+    assert hist.current() == "19"
 
     # move can be expressed as multiple calls to back and forward
-    h.move(-3)
-    h.forward()
-    h.forward()
-    h.forward()
-    assert h.current() == "19"
+    hist.move(-3)
+    hist.forward()
+    hist.forward()
+    hist.forward()
+    assert hist.current() == "19"
 
     # back, forward, move play well with boundaries
     for _ in range(30):
-        h.back()
+        hist.back()
 
     for _ in range(30):
-        h.forward()
+        hist.forward()
 
     for _ in range(30):
-        h.move(-2)
+        hist.move(-2)
 
     for _ in range(30):
-        h.move(2)
-    assert h.current() == "19"
+        hist.move(2)
+    assert hist.current() == "19"
 
     # we can create an history from another history
-    h = history.History(maxlen=10)
+    hist = history.History(maxlen=10)
     for entry in HISTORY_TEST_ENTRIES:
-        h.add(entry)
+        hist.add(entry)
     # XXX maxlen should not be used to refer to something that isn't a length
-    otherh = history.History(maxlen=h)
-    assert(list(h) == list(otherh))
+    otherh = history.History(maxlen=hist)
+    assert list(hist) == list(otherh)
 
     # Rebase replaces the past of the history with that of another
-    otherh = history.History(maxlen=h)
-    old_current_item = h.current()
+    otherh = history.History(maxlen=hist)
+    old_current_item = hist.current()
     for entry in OTHER_TEST_ENTRIES:
         otherh.add(entry)
     assert list(otherh)[-3:] == ["42", "43", "44"]
-    h.rebase(otherh)
-    assert h.current() == old_current_item
-    assert list(h)[-3:] == ['43', '44', old_current_item]
+    hist.rebase(otherh)
+    assert hist.current() == old_current_item
+    assert list(hist)[-3:] == ['43', '44', old_current_item]
 
     # modify, modifies the top of the stack
-    h.modify("23")
-    assert h.current() == "23"
+    hist.modify("23")
+    assert hist.current() == "23"
 
 
 def testhistoryunique():
     # Check that unique history refuses to store duplicated entries
-    h = history.History(maxlen=10, unique=True)
+    hist = history.History(maxlen=10, unique=True)
     for entry in HISTORY_TEST_ENTRIES:
-        h.add(entry)
-    assert h.current() == "19"
-    h.add("17")
-    assert list(h).count("17") == 1
-    assert h.current() == "17"
+        hist.add(entry)
+    assert hist.current() == "19"
+    hist.add("17")
+    assert list(hist).count("17") == 1
+    assert hist.current() == "17"
diff --git a/tests/ranger/container/test_fsobject.py b/tests/ranger/container/test_fsobject.py
index 73d2024a..49c15666 100644
--- a/tests/ranger/container/test_fsobject.py
+++ b/tests/ranger/container/test_fsobject.py
@@ -1,10 +1,9 @@
-import pytest
 import operator
 
 from ranger.container.fsobject import FileSystemObject
 
 
-class MockFM(object):
+class MockFM(object):  # pylint: disable=too-few-public-methods
     """Used to fulfill the dependency by FileSystemObject."""
 
     default_linemodes = []
@@ -22,13 +21,13 @@ def test_basename_natural1():
     """Test filenames without extensions."""
     fsos = [create_filesystem_object(path)
             for path in ("hello", "hello1", "hello2")]
-    assert(fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural")))
-    assert(fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower")))
+    assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural"))
+    assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower"))
 
 
 def test_basename_natural2():
     """Test filenames with extensions."""
     fsos = [create_filesystem_object(path)
             for path in ("hello", "hello.txt", "hello1.txt", "hello2.txt")]
-    assert(fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural")))
-    assert(fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower")))
+    assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural"))
+    assert fsos == sorted(fsos[::-1], key=operator.attrgetter("basename_natural_lower"))