Best Python code snippet using fMBT_python
test_winprops.py
Source: test_winprops.py
1from panda3d.core import WindowProperties2import pytest3def test_winprops_ctor():4 props = WindowProperties()5 assert not props.is_any_specified()6def test_winprops_copy_ctor():7 props = WindowProperties()8 props.set_size(1, 2)9 props2 = WindowProperties(props)10 assert props == props211 assert props2.get_size() == (1, 2)12 with pytest.raises(TypeError):13 WindowProperties(None)14def test_winprops_ctor_kwargs():15 props = WindowProperties(size=(1, 2), origin=3)16 assert props.has_size()17 assert props.get_size() == (1, 2)18 assert props.has_origin()19 assert props.get_origin() == (3, 3)20 # Invalid property should throw21 with pytest.raises(TypeError):22 WindowProperties(swallow_type="african")23 # Invalid value should throw24 with pytest.raises(TypeError):25 WindowProperties(size="invalid")26def test_winprops_size_staticmethod():27 props = WindowProperties.size(1, 2)28 assert props.has_size()29 assert props.get_size() == (1, 2)30 props = WindowProperties.size((1, 2))31 assert props.has_size()32 assert props.get_size() == (1, 2)33def test_winprops_size_property():34 props = WindowProperties()35 # Test get36 props.set_size(1, 2)37 assert props.size == (1, 2)38 # Test has39 props.clear_size()40 assert props.size is None41 # Test set42 props.size = (4, 5)43 assert props.get_size() == (4, 5)44 # Test clear45 props.size = None...
main.py
Source: main.py
1from PyQt5.QtWidgets import QApplication2import windowproperties, mainwindow, sys, altwindow, bot3class Application(QApplication):4 def __init__(self, name):5 super(Application).__init__()6 self.setApplicationName(name)7 self.app = QApplication(sys.argv)8 properties = windowproperties.WindowProperties.load_from_json(windowproperties.WindowProperties.config)9 self.window = mainwindow.MainWindow(properties, self, self.applicationName())10 self.windows = [self.window]11 self.alt_window = None12 13 def run(self):14 self.app.exec_()15 def create_alt_window(self):16 self.alt_window = altwindow.AltWindow(windowproperties.WindowProperties.load_from_json(windowproperties.WindowProperties.config), self)17 self.alt_window.show()18 def quit(self, macro):19 macro.disable()20 self.window.browser.page().deleteLater()21 self.app.quit()22 def register_alt_window(self, window):23 self.windows.append(window)24 25 def unregister_alt_window(self, window):26 self.windows.remove(window)...
Check out the latest blogs from LambdaTest on this topic:
Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
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!!