Best Python code snippet using lisa_python
folder.py
Source: folder.py
...108 parent = item.parent()109 if parent:110 checked = parent.object.data().checked.all()111 # checked = _all_children_checked(parent) # TEST!112 _set_check_state(parent, checked)113 _check_parents(parent)114def _all_children_checked(item):115 """Set the checkstate of all children of an item."""116 nrOfChildren = item.childCount()117 for n in range(nrOfChildren):118 child = item.child(n) 119 checked = child.checkState(0) == Qt.Checked120 if not checked: return False121 return True122def _toggle_checked(item):123 "Uncheck if checked and check if unchecked."124 checked = item.checkState(0) == Qt.Checked125 _set_checked(item, not checked)126def _set_checked(item, checked):127 """Check or uncheck an item"""128 _set_check_state(item, checked)129 _check_children(item, checked)130def _set_check_state(item, checked):131 """Ticks or unticks the box"""132 if checked: 133 item.setCheckState(0, Qt.Checked)134 else: 135 item.setCheckState(0, Qt.Unchecked)136def _save_checked(item): 137 """Save the item checked state."""138 files = item.object.files # SLOW139 checked = item.checkState(0) == Qt.Checked140 item.object.folder.dataframe.loc[files, 'checked'] = checked141def _check_children(item, checked):142 """Set the checkstate of all children of an item."""143 nrOfChildren = item.childCount()144 for n in range(nrOfChildren):...
check_list.py
Source: check_list.py
...58 item = self.list.item(i)59 if item.checkState() == QtCore.Qt.Checked:60 yield item.text()61 def check_all(self):62 self._set_check_state(QtCore.Qt.Checked)63 def uncheck_all(self):64 self._set_check_state(QtCore.Qt.Unchecked)65 def invert_checked(self):66 for i in range(self.list.count()):67 item = self.list.item(i)68 if item.checkState() == QtCore.Qt.Checked:69 item.setCheckState(QtCore.Qt.Unchecked)70 else:71 item.setCheckState(QtCore.Qt.Checked)72 def check_selected(self):73 for i in range(self.list.count()):74 item = self.list.item(i)75 if item.isSelected():76 item.setCheckState(QtCore.Qt.Checked)77 else:78 item.setCheckState(QtCore.Qt.Unchecked)79 def check_items(self, items: Sequence[str]):80 for item in items:81 for match in self.list.findItems(item, QtCore.Qt.MatchExactly):82 match.setCheckState(QtCore.Qt.Checked)83 def _set_check_state(self, state: QtCore.Qt.CheckState):84 for i in range(self.list.count()):85 self.list.item(i).setCheckState(state)86 def _on_item_changed(self, item: QtWidgets.QListWidgetItem):87 self.item_changed.emit(item)88 def _on_context_menu(self, pos: QtCore.QPoint):89 if len(self.context_menu.actions()) == 0:90 return91 action = self.context_menu.exec_(self.list.mapToGlobal(pos))92 if action is None:93 return94 action_fn = action.data()95 action_fn()96 def _on_filter_changed(self, text: str):97 search_text = text.strip().lower()...
test_legacy_runner.py
Source: test_legacy_runner.py
...16log = get_logger("test_legacy")17class ResultStateManagerTestCase(TestCase):18 def test_sequence_running(self) -> None:19 states = legacy_runner.ResultStateManager("legacy", log)20 self._set_check_state(21 states,22 4,23 0,24 0,25 [26 TestStatus.QUEUED,27 TestStatus.QUEUED,28 TestStatus.QUEUED,29 TestStatus.QUEUED,30 ],31 )32 self._set_check_state(33 states,34 4,35 1,36 0,37 [38 TestStatus.RUNNING,39 TestStatus.QUEUED,40 TestStatus.QUEUED,41 TestStatus.QUEUED,42 ],43 )44 self._set_check_state(45 states,46 4,47 1,48 1,49 [50 TestStatus.PASSED,51 TestStatus.QUEUED,52 TestStatus.QUEUED,53 TestStatus.QUEUED,54 ],55 )56 self._set_check_state(57 states,58 4,59 2,60 1,61 [62 TestStatus.PASSED,63 TestStatus.RUNNING,64 TestStatus.QUEUED,65 TestStatus.QUEUED,66 ],67 )68 self._set_check_state(69 states,70 4,71 2,72 2,73 [74 TestStatus.PASSED,75 TestStatus.PASSED,76 TestStatus.QUEUED,77 TestStatus.QUEUED,78 ],79 )80 self._set_check_state(81 states,82 4,83 3,84 2,85 [86 TestStatus.PASSED,87 TestStatus.PASSED,88 TestStatus.RUNNING,89 TestStatus.QUEUED,90 ],91 )92 self._set_check_state(93 states,94 4,95 4,96 3,97 [98 TestStatus.PASSED,99 TestStatus.PASSED,100 TestStatus.PASSED,101 TestStatus.RUNNING,102 ],103 )104 self._set_check_state(105 states,106 4,107 4,108 4,109 [110 TestStatus.PASSED,111 TestStatus.PASSED,112 TestStatus.PASSED,113 TestStatus.PASSED,114 ],115 )116 def _set_check_state(117 self,118 state: legacy_runner.ResultStateManager,119 all_count: int,120 running_count: int,121 completed_count: int,122 expected_statuses: List[TestStatus],123 ) -> None:124 all = self._create_information(all_count, TestStatus.QUEUED)125 running = self._create_information(running_count, TestStatus.RUNNING)126 completed = self._create_information(completed_count, TestStatus.PASSED)127 state.set_states(all, running, completed)128 self.assertListEqual([x.status for x in state._results], expected_statuses)129 def _create_information(130 self, count: int, status: TestStatus...
Check out the latest blogs from LambdaTest on this topic:
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?
When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!