Best Python code snippet using selene_python
base.py
Source:base.py
...14 'polygon_holes':'{"type":"Polygon","coordinates":[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]}',15 'multipoint':'{"type":"MultiPoint","coordinates":[[100.0,0.0],[101.0,1.0]]}',16 'multiline':'{"type":"MultiLineString","coordinates":[[[100.0,0.0],[101.0,1.0]],[[102.0,2.0],[103.0,3.0]]]}',17 'multipolygon':'{"type":"MultiPolygon","coordinates":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]],[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]]}'}18def _execute_script(script_path):19 conn = Session.connection()20 script = open(script_path, 'r').read()21 for cmd in script.split(';'):22 cmd = re.sub(r'--(.*)|[\n\t]', '', cmd)23 if len(cmd):24 conn.execute(cmd)25 Session.commit()26def create_postgis_tables():27 scripts_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),28 'scripts')29 if postgis_version()[:1] == '1':30 _execute_script(os.path.join(scripts_path, 'spatial_ref_sys.sql'))31 _execute_script(os.path.join(scripts_path, 'geometry_columns.sql'))32 else:33 _execute_script(os.path.join(scripts_path, 'spatial_ref_sys.sql'))34class SpatialTestBase(object):35 db_srid = 432636 geojson_examples = geojson_examples37 @classmethod38 def setup_class(cls):39 if engine_is_sqlite():40 raise SkipTest("PostGIS is required for this test")41 # This will create the PostGIS tables (geometry_columns and42 # spatial_ref_sys) which were deleted when rebuilding the database43 table = Table('spatial_ref_sys', meta.metadata)44 if not table.exists():45 create_postgis_tables()46 # When running the tests with the --reset-db option for some47 # reason the metadata holds a reference to the `package_extent`...
game_master.py
Source:game_master.py
...25 def next_state(self, scene):26 self._builder.change_script(scene, self._script)27 def start(self):28 self._builder.change_script(INITIALIZE, self._script)29 self._execute_script(INITIALIZE)30 while self._vs.is_window_open():31 self._execute_script(INPUT)32 self._execute_script(UPDATE)33 self._execute_script(OUTPUT)34 def _execute_script(self,group):35 actions = self._script.get_actions(group)36 for action in actions:...
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!!