new tests from before
This commit is contained in:
27
tests/test_dict_list_widget.py
Normal file
27
tests/test_dict_list_widget.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from grum.dictlist.dictlistwidget import DictListWidget
|
||||||
|
from grum.menus.rclickmenu import RClickMenu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DictListWidgetMock(DictListWidget):
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.items = {}
|
||||||
|
self.nkeep = None
|
||||||
|
|
||||||
|
def get_DictListWidgetMock():
|
||||||
|
return DictListWidgetMock()
|
||||||
|
|
||||||
|
# def test_defaults():
|
||||||
|
# dlw = get_DictListWidgetMock()
|
||||||
|
|
||||||
|
# assert dlw.items == {}
|
||||||
|
# assert dlw.nkeep == None
|
||||||
|
|
||||||
|
# def test_add_menu():
|
||||||
|
# dlw = get_DictListWidgetMock()
|
||||||
|
# dlw._add_menu()
|
||||||
|
|
||||||
|
# assert dlw.menu == RClickMenu(dlw)
|
@ -21,7 +21,6 @@ from grum.rpc import RPCServerThread
|
|||||||
class TestMainWin:
|
class TestMainWin:
|
||||||
|
|
||||||
def setup_method(self):
|
def setup_method(self):
|
||||||
print("setup")
|
|
||||||
self.app = QApplication(sys.argv)
|
self.app = QApplication(sys.argv)
|
||||||
theme.apply(self.app)
|
theme.apply(self.app)
|
||||||
# ctrl_c.setup(self.app)
|
# ctrl_c.setup(self.app)
|
||||||
@ -30,10 +29,8 @@ class TestMainWin:
|
|||||||
|
|
||||||
|
|
||||||
def teardown_method(self):
|
def teardown_method(self):
|
||||||
print("teardown")
|
|
||||||
self.mw.rst.wait_for_stop()
|
self.mw.rst.wait_for_stop()
|
||||||
self.app.quit()
|
self.app.quit()
|
||||||
print("app quit called")
|
|
||||||
del self.mw
|
del self.mw
|
||||||
del self.app
|
del self.app
|
||||||
|
|
||||||
@ -168,6 +165,19 @@ class TestMainWin:
|
|||||||
mw.plot_multiple_items.assert_called_once_with([sine_item, cosine_item])
|
mw.plot_multiple_items.assert_called_once_with([sine_item, cosine_item])
|
||||||
|
|
||||||
|
|
||||||
|
def test_on_sort_by_name(self):
|
||||||
|
mw = self.mw
|
||||||
|
mw.lst = DictList()
|
||||||
|
mw.new_plot("bb", {})
|
||||||
|
mw.new_plot("dd", {})
|
||||||
|
mw.new_plot("aa", {})
|
||||||
|
mw.new_plot("cc", {})
|
||||||
|
|
||||||
|
assert mw.lst.lst.items == 111
|
||||||
|
assert [key for key in mw.lst.lst.items.keys()] == ['bb', 'dd', 'aa', 'cc']
|
||||||
|
mw.on_sort_by_name()
|
||||||
|
assert mw.lst.lst.items == 111
|
||||||
|
|
||||||
def test_plot_single_item(self):
|
def test_plot_single_item(self):
|
||||||
mw = self.mw
|
mw = self.mw
|
||||||
sine_item = mw.lst.lst.get("sine")
|
sine_item = mw.lst.lst.get("sine")
|
||||||
|
Reference in New Issue
Block a user