mirror of
https://github.com/pyapp-kit/superqt.git
synced 2025-12-16 03:00:05 +01:00
Fix some small linting issues. (#41)
* fix some linting * add tests * update versions * update setup
This commit is contained in:
@@ -9,12 +9,12 @@ def test_checked_initialization(qtbot):
|
||||
"""Test simple collapsible"""
|
||||
wdg1 = QCollapsible("Advanced analysis")
|
||||
wdg1.expand(False)
|
||||
assert wdg1.expanded() is True
|
||||
assert wdg1.isExpanded()
|
||||
assert wdg1._content.maximumHeight() > 0
|
||||
|
||||
wdg2 = QCollapsible("Advanced analysis")
|
||||
wdg1.collapse(False)
|
||||
assert wdg2.expanded() is False
|
||||
assert not wdg2.isExpanded()
|
||||
assert wdg2._content.maximumHeight() == 0
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ def test_content_hide_show(qtbot):
|
||||
collapsible.addWidget(QPushButton(f"Content button {i + 1}"))
|
||||
|
||||
collapsible.collapse(False)
|
||||
assert collapsible.expanded() is False
|
||||
assert not collapsible.isExpanded()
|
||||
assert collapsible._content.maximumHeight() == 0
|
||||
|
||||
collapsible.expand(False)
|
||||
assert collapsible.expanded() is True
|
||||
assert collapsible.isExpanded()
|
||||
assert collapsible._content.maximumHeight() > 0
|
||||
|
||||
|
||||
@@ -41,12 +41,24 @@ def test_locking(qtbot):
|
||||
assert wdg1.locked() is False
|
||||
wdg1.setLocked(True)
|
||||
assert wdg1.locked() is True
|
||||
assert not wdg1.isExpanded()
|
||||
|
||||
# Simulate button press
|
||||
wdg1._toggle_btn.setChecked(True)
|
||||
wdg1._toggle()
|
||||
assert not wdg1.isExpanded()
|
||||
|
||||
assert wdg1.expanded() is False
|
||||
wdg1._toggle()
|
||||
assert not wdg1.isExpanded()
|
||||
|
||||
wdg1.expand()
|
||||
assert not wdg1.isExpanded()
|
||||
|
||||
wdg1._toggle_btn.setChecked(False)
|
||||
assert not wdg1.isExpanded()
|
||||
|
||||
wdg1.setLocked(False)
|
||||
wdg1.expand()
|
||||
assert wdg1.isExpanded()
|
||||
assert wdg1._toggle_btn.isChecked()
|
||||
|
||||
|
||||
def test_changing_animation_settings(qtbot):
|
||||
@@ -64,3 +76,11 @@ def test_changing_content(qtbot):
|
||||
wdg = QCollapsible()
|
||||
wdg.setContent(content)
|
||||
assert wdg._content == content
|
||||
|
||||
|
||||
def test_changing_text(qtbot):
|
||||
"""Test changing the content"""
|
||||
wdg = QCollapsible()
|
||||
wdg.setText("Hi new text")
|
||||
assert wdg.text() == "Hi new text"
|
||||
assert wdg._toggle_btn.text() == QCollapsible._COLLAPSED + "Hi new text"
|
||||
|
||||
Reference in New Issue
Block a user