tests: use "if not parent_elem"
Also add a new test for browsing the root directory
This commit is contained in:
parent
6a96e1d6d8
commit
2db5b95552
@ -117,7 +117,7 @@ class DirLayout:
|
|||||||
container = soup('div', id='dirbrowserContainer')[0]
|
container = soup('div', id='dirbrowserContainer')[0]
|
||||||
|
|
||||||
parent_elem = container('ul', class_='parent')
|
parent_elem = container('ul', class_='parent')
|
||||||
if len(parent_elem) == 0:
|
if not parent_elem:
|
||||||
parent = None
|
parent = None
|
||||||
else:
|
else:
|
||||||
parent = QUrl(parent_elem[0].li.a['href']).toLocalFile()
|
parent = QUrl(parent_elem[0].li.a['href']).toLocalFile()
|
||||||
@ -155,6 +155,15 @@ def test_parent_with_slash(dir_layout, quteproc):
|
|||||||
assert page.parent == dir_layout.base_path()
|
assert page.parent == dir_layout.base_path()
|
||||||
|
|
||||||
|
|
||||||
|
def test_parent_in_root_dir(dir_layout, quteproc):
|
||||||
|
# This actually works on windows
|
||||||
|
root_path = os.path.realpath('/')
|
||||||
|
urlstr = QUrl.fromLocalFile(root_path).toString(QUrl.FullyEncoded)
|
||||||
|
quteproc.open_url(urlstr)
|
||||||
|
page = dir_layout.parse(quteproc)
|
||||||
|
assert page.parent is None
|
||||||
|
|
||||||
|
|
||||||
def test_enter_folder_smoke(dir_layout, quteproc):
|
def test_enter_folder_smoke(dir_layout, quteproc):
|
||||||
quteproc.open_url(dir_layout.file_url())
|
quteproc.open_url(dir_layout.file_url())
|
||||||
quteproc.send_cmd(':hint all normal')
|
quteproc.send_cmd(':hint all normal')
|
||||||
|
@ -124,7 +124,7 @@ class TestDirbrowserHtml:
|
|||||||
container = soup('div', id='dirbrowserContainer')[0]
|
container = soup('div', id='dirbrowserContainer')[0]
|
||||||
|
|
||||||
parent_elem = container('ul', class_='parent')
|
parent_elem = container('ul', class_='parent')
|
||||||
if len(parent_elem) == 0:
|
if not parent_elem:
|
||||||
parent = None
|
parent = None
|
||||||
else:
|
else:
|
||||||
parent = parent_elem[0].li.a.string
|
parent = parent_elem[0].li.a.string
|
||||||
|
Loading…
Reference in New Issue
Block a user