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

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