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:

Putting Together a Testing Team

As part of one of my consulting efforts, I worked with a mid-sized company that was looking to move toward a more agile manner of developing software. As with any shift in work style, there is some bewilderment and, for some, considerable anxiety. People are being challenged to leave their comfort zones and embrace a continuously changing, dynamic working environment. And, dare I say it, testing may be the most ‘disturbed’ of the software roles in agile development.

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.

QA’s and Unit Testing – Can QA Create Effective Unit Tests

Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.

The Art of Testing the Untestable

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?

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

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