How to use _mock_env method in molecule

Best Python code snippet using molecule_python

mock_sc2_env_comparison_test.py

Source: mock_sc2_env_comparison_test.py Github

copy

Full Screen

1#!/​usr/​bin/​python2# Copyright 2017 Google Inc. All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http:/​/​www.apache.org/​licenses/​LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS-IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15"""Tests that mock environment has same shape outputs as true environment."""16from __future__ import absolute_import17from __future__ import division18from __future__ import print_function19from absl.testing import absltest20from pysc2.env import mock_sc2_env21from pysc2.env import sc2_env22class TestCompareEnvironments(absltest.TestCase):23 @classmethod24 def setUpClass(cls):25 super(TestCompareEnvironments, cls).setUpClass()26 players = [27 sc2_env.Agent(race=sc2_env.Race.terran),28 sc2_env.Agent(race=sc2_env.Race.protoss),29 ]30 kwargs = {31 'map_name': 'Flat64',32 'players': players,33 'agent_interface_format': [34 sc2_env.AgentInterfaceFormat(35 feature_dimensions=sc2_env.Dimensions(36 screen=(32, 64),37 minimap=(8, 16)38 ),39 rgb_dimensions=sc2_env.Dimensions(40 screen=(31, 63),41 minimap=(7, 15)42 ),43 action_space=sc2_env.ActionSpace.FEATURES44 ),45 sc2_env.AgentInterfaceFormat(46 rgb_dimensions=sc2_env.Dimensions(screen=64, minimap=32)47 )48 ]49 }50 cls._env = sc2_env.SC2Env(**kwargs)51 cls._mock_env = mock_sc2_env.SC2TestEnv(**kwargs)52 @classmethod53 def tearDownClass(cls):54 super(TestCompareEnvironments, cls).tearDownClass()55 cls._env.close()56 cls._mock_env.close()57 def test_observation_spec(self):58 self.assertEqual(self._env.observation_spec(),59 self._mock_env.observation_spec())60 def test_action_spec(self):61 self.assertEqual(self._env.action_spec(), self._mock_env.action_spec())62if __name__ == '__main__':...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

LIVE With Automation Testing For OTT Streaming Devices ????

People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.

How To Refresh Page Using Selenium C# [Complete Tutorial]

When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.

Two-phase Model-based Testing

Most test automation tools just do test execution automation. Without test design involved in the whole test automation process, the test cases remain ad hoc and detect only simple bugs. This solution is just automation without real testing. In addition, test execution automation is very inefficient.

Stop Losing Money. Invest in Software Testing

I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.

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 molecule 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