You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/winpython/_vendor/qtpy/tests/test_qdesktopservice_split.py

42 lines
1.3 KiB

"""Test QDesktopServices split in Qt5."""
from __future__ import absolute_import
import pytest
import warnings
from qtpy import PYQT4, PYSIDE
def test_qstandarpath():
"""Test the qtpy.QStandardPaths namespace"""
from qtpy.QtCore import QStandardPaths
assert QStandardPaths.StandardLocation is not None
# Attributes from QDesktopServices shouldn't be in QStandardPaths
with pytest.raises(AttributeError) as excinfo:
QStandardPaths.setUrlHandler
def test_qdesktopservice():
"""Test the qtpy.QDesktopServices namespace"""
from qtpy.QtGui import QDesktopServices
assert QDesktopServices.setUrlHandler is not None
@pytest.mark.skipif(not (PYQT4 or PYSIDE), reason="Warning is only raised in old bindings")
def test_qdesktopservice_qt4_pyside():
from qtpy.QtGui import QDesktopServices
# Attributes from QStandardPaths should raise a warning when imported
# from QDesktopServices
with warnings.catch_warnings(record=True) as w:
# Cause all warnings to always be triggered.
warnings.simplefilter("always")
# Try to import QtHelp.
QDesktopServices.StandardLocation
assert len(w) == 1
assert issubclass(w[-1].category, DeprecationWarning)
assert "deprecated" in str(w[-1].message)