Best Python code snippet using avocado_python
test_basic.py
Source:test_basic.py  
...176        mytest.save()177        cmd_line = ("./scripts/avocado run --sysinfo=off --job-results-dir %s "178                    "%s" % (self.tmpdir, mytest))179        process.run(cmd_line)180    def test_unsupported_status(self):181        os.chdir(basedir)182        with script.TemporaryScript("fake_status.py",183                                    UNSUPPORTED_STATUS_TEST_CONTENTS,184                                    "avocado_unsupported_status") as tst:185            res = process.run("./scripts/avocado run --sysinfo=off "186                              "--job-results-dir %s %s --json -"187                              % (self.tmpdir, tst), ignore_status=True)188            self.assertEqual(res.exit_status, exit_codes.AVOCADO_TESTS_FAIL)189            results = json.loads(res.stdout)190            self.assertEqual(results["tests"][0]["status"], "ERROR",191                             "%s != %s\n%s" % (results["tests"][0]["status"],192                                               "ERROR", res))193            self.assertIn("Runner error occurred: Test reports unsupported",194                          results["tests"][0]["fail_reason"])...test_tasks.py
Source:test_tasks.py  
...441             'sample_issues': self.n_samples},442            1)443    @patch("validation.tasks.MetaDataValidation.check_usi_structure")444    @patch("validation.tasks.MetaDataValidation.validate")445    def test_unsupported_status(446            self, my_validate, my_check):447        """This test will ensure that image_validation ValidationResultRecord448        still support the same statuses"""449        # setting check_usi_structure result. now is a ValidateResultRecord450        result = PickableMock()451        result.get_overall_status.return_value = "Pass"452        result.get_messages.return_value = []453        my_check.return_value = result454        # setting a return value for check_with_ruleset455        rule_result = PickableMock()456        rule_result.get_overall_status.return_value = "A fake status"457        rule_result.get_messages.return_value = ["A fake message", ]458        result_set = Mock()459        result_set.get_comparable_str.return_value = "A fake message"...test_status.py
Source:test_status.py  
...21        ac_status = JciHitachiAC(dev_status).status22        23        for status in ac_status.values():24            assert status != "unknown" and status != None25    def test_unsupported_status(self):26        dev_status = {}27        ac_status = JciHitachiAC(dev_status).status28        for status in ac_status.values():29            assert status == "unsupported" or status == -130    def test_correctness(self):31        dev_status = JciHitachiStatusInterpreter(MOCK_CODE_AC).decode_status()32        ac_status = JciHitachiAC(dev_status).status33        mock_status = {34            'power': 'off',35            'mode': 'cool',36            'air_speed': 'silent',37            'target_temp': 26,38            'indoor_temp': 26,39            'sleep_timer': 0,40            'vertical_wind_swingable': 'unsupported',41            'vertical_wind_direction': -1,42            'horizontal_wind_direction': 'unsupported',43            'mold_prev': 'disabled',44            'fast_op': 'disabled',45            'energy_save': 'disabled',46            'sound_prompt': 'enabled',47            'outdoor_temp': 24,48            'power_kwh': 0.0,49            'freeze_clean': 'off',50        }51        for key, value in ac_status.items():52            assert key in mock_status53            assert mock_status[key] == value54    def test_limit(self):55        dev_support = JciHitachiStatusInterpreter(MOCK_SUPPORT_CODE_AC).decode_support()56        ac_support = JciHitachiACSupport(dev_support)57        mock_status_raw = {58            'power': 0,59            'mode': 0,60            'air_speed': 1,61            'target_temp': 26,62            'indoor_temp': 26,63            'sleep_timer': 0,64            'vertical_wind_swingable': -1,65            'vertical_wind_direction': -1,66            'horizontal_wind_direction': -1,67            'mold_prev': 0,68            'fast_op': 0,69            'energy_save': 0,70            'sound_prompt': 0,71            'outdoor_temp': 24,72            'power_kwh': 073        }74        mock_status_raw_limited = {key: ac_support.limit(key, value) for key, value in mock_status_raw.items()}75        for key, raw_value in mock_status_raw.items():76            if raw_value == -1:77                raw_value = None78            if key == "outdoor_temp": # The supported `outdoor_temp` values seem not correct so the limited values are incorrect too. skipping this test.79                continue80            assert raw_value == mock_status_raw_limited[key]81    def test_command(self):82        commander = JciHitachiCommandAC(MOCK_GATEWAY_MAC)83        b64command = commander.get_command(MOCK_COMMAND_AC, 0)84        85        mock_command = bytearray.fromhex(86                        "d0d100003c6a9dffff03e0d4ffffffff \87                        00000100000000000000002000010000 \88                        908D9859F3FD7f6c02000d278050f0d4 \89                        469dafd3605a6ebbdb130d278052f0d4 \90                        469dafd3605a6ebbdb13060006019E00 \91                        0099")92        assert b64command == mock_command93class TestDHStatus:94    def test_model_brand(self):95        dev_support = JciHitachiStatusInterpreter(96            MOCK_SUPPORT_CODE_DH).decode_support()97        dh_support = JciHitachiDHSupport(dev_support)98        assert dh_support.brand == "HITACHI"99        assert dh_support.model == "RD-360HH"100    def test_supported_status(self):101        dev_status = JciHitachiStatusInterpreter(MOCK_CODE_DH).decode_status()102        dh_status = JciHitachiDH(dev_status).status103        for status in dh_status.values():104            assert status != "unknown" and status != None105    def test_unsupported_status(self):106        dev_status = {}107        ac_status = JciHitachiDH(dev_status).status108        for status in ac_status.values():109            assert status == "unsupported" or status == -1110    def test_correctness(self):111        dev_status = JciHitachiStatusInterpreter(MOCK_CODE_DH).decode_status()112        ac_status = JciHitachiDH(dev_status).status113        mock_status = {114            'power': 'on',115            'mode': 'custom',116            'target_humidity': 70,117            'indoor_humidity': 70,118            'wind_swingable': 'on',119            'water_full_warning': 'off',...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!!
