How to use mainloop method in ATX

Best Python code snippet using ATX

test_pulse.py

Source:test_pulse.py Github

copy

Full Screen

...12except ImportError:13 interface = None14pytestmark = pytest.mark.skipif(interface is None, reason='requires PulseAudio')15@pytest.fixture16def mainloop():17 return interface.PulseAudioMainLoop()18def test_mainloop_run(mainloop):19 mainloop.start()20 mainloop.delete()21def test_mainloop_lock(mainloop):22 mainloop.start()23 mainloop.lock()24 mainloop.unlock()25 mainloop.delete()26def test_mainloop_signal(mainloop):27 mainloop.start()28 with mainloop:29 mainloop.signal()30 mainloop.delete()...

Full Screen

Full Screen

test_connect4.py

Source:test_connect4.py Github

copy

Full Screen

1import unittest2from typing import List, Dict3import pandas as pd4from ...controls.controllers import Passive5from ...controls.wrappers import ControllerWrapper6from ...examples.connect4.builder import create_game7class TestConnect4(unittest.TestCase):8 def setUp(self):9 self.mainLoop = create_game({1: Passive, 2: Passive}, 360, 360)10 wrappers = list(self.mainLoop.wrappers.keys()) # type: List[ControllerWrapper]11 self.playersWrappers = None # type: Dict[int, ControllerWrapper]12 self.playersWrappers = {wrapper.controller.playerNumber: wrapper13 for wrapper in wrappers}14 def test_easy_win(self):15 self.mainLoop.api.performMove(1, 0)16 self.mainLoop.api.performMove(2, 1)17 self.mainLoop.api.performMove(1, 0)18 self.mainLoop.api.performMove(2, 1)19 self.mainLoop.api.performMove(1, 0)20 self.mainLoop.api.performMove(2, 1)21 self.mainLoop.api.performMove(1, 0)22 self.mainLoop.api.performMove(2, 1) # Plays after the end of the game => should not influence23 self.assertTrue(self.mainLoop.api.isFinished())24 self.assertTrue(self.mainLoop.api.hasWon(1))25 def test_easy_win2(self):26 self.mainLoop.api.performMove(1, 0)27 self.mainLoop.api.performMove(2, 1)28 self.mainLoop.api.performMove(1, 2)29 self.mainLoop.api.performMove(2, 1)30 self.mainLoop.api.performMove(1, 0)31 self.mainLoop.api.performMove(2, 1)32 self.mainLoop.api.performMove(1, 0)33 self.mainLoop.api.performMove(2, 1)34 self.assertTrue(self.mainLoop.api.isFinished())35 self.assertTrue(self.mainLoop.api.hasWon(2))36 def test_diagonal_win(self):37 self.mainLoop.api.performMove(1, 0)38 self.mainLoop.api.performMove(2, 1)39 self.mainLoop.api.performMove(1, 1)40 self.mainLoop.api.performMove(2, 2)41 self.mainLoop.api.performMove(1, 2)42 self.mainLoop.api.performMove(2, 3)43 self.mainLoop.api.performMove(1, 2)44 self.mainLoop.api.performMove(2, 3)45 self.mainLoop.api.performMove(1, 3)46 self.mainLoop.api.performMove(2, 5)47 self.mainLoop.api.performMove(1, 3)48 self.assertTrue(self.mainLoop.api.isFinished())49 self.assertTrue(self.mainLoop.api.hasWon(1))50 def test_unfeasible(self):51 self.mainLoop.api.performMove(1, 0)52 self.mainLoop.api.performMove(2, 0)53 self.mainLoop.api.performMove(1, 0)54 self.mainLoop.api.performMove(2, 0)55 self.mainLoop.api.performMove(1, 0)56 self.mainLoop.api.performMove(2, 0)57 succeeded = self.mainLoop.api.performMove(1, 0)58 self.assertFalse(succeeded)59 def test_action_history(self):60 self.mainLoop.api.performMove(1, 1)61 self.mainLoop.api.performMove(2, 2)62 self.mainLoop.api.performMove(1, 3)63 self.mainLoop.api.performMove(2, 4)64 self.mainLoop.api.performMove(1, 5)65 self.mainLoop.api.performMove(2, 6)66 self.mainLoop.api.performMove(1, 0)67 self.mainLoop.api.performMove(2, 1)68 self.mainLoop.api.performMove(1, 2)69 self.mainLoop.api.performMove(2, 3)70 self.assertEqual(self.mainLoop.api.getActionsHistory(1), [1, 3, 5, 0, 2])71 self.assertEqual(self.mainLoop.api.getActionsHistory(2), [2, 4, 6, 1, 3])72 is_equal = self.mainLoop.api.getAllActionsHistories() == pd.DataFrame([[1, 3, 5, 0, 2], [2, 4, 6, 1, 3]])...

Full Screen

Full Screen

mainloop.py

Source:mainloop.py Github

copy

Full Screen

...69 self._thread.join()70 self._thread = None71 72 @property73 def mainloop(self):74 """Returns the attached mainloop.75 """76 return self._mainloop77def _get_native_mainloop(mainloop, argument_name="mainloop"):78 if isinstance(mainloop, Mainloop):79 return mainloop.mainloop80 81 if isinstance(mainloop, MainloopThread):82 return mainloop.mainloop.mainloop83 ...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful