diff --git a/tests/integration/test_dirbrowser.py b/tests/integration/test_dirbrowser.py index d95f59cea..7f93326d3 100644 --- a/tests/integration/test_dirbrowser.py +++ b/tests/integration/test_dirbrowser.py @@ -117,7 +117,7 @@ class DirLayout: container = soup('div', id='dirbrowserContainer')[0] parent_elem = container('ul', class_='parent') - if len(parent_elem) == 0: + if not parent_elem: parent = None else: 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() +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): quteproc.open_url(dir_layout.file_url()) quteproc.send_cmd(':hint all normal') diff --git a/tests/unit/browser/network/test_filescheme.py b/tests/unit/browser/network/test_filescheme.py index e57b5ee55..1321a649c 100644 --- a/tests/unit/browser/network/test_filescheme.py +++ b/tests/unit/browser/network/test_filescheme.py @@ -124,7 +124,7 @@ class TestDirbrowserHtml: container = soup('div', id='dirbrowserContainer')[0] parent_elem = container('ul', class_='parent') - if len(parent_elem) == 0: + if not parent_elem: parent = None else: parent = parent_elem[0].li.a.string