Best Python code snippet using autotest_python
base_utils_unittest.py
Source:base_utils_unittest.py  
...395        self.assertEqual(proc.returncode, 0)396        self.assertEqual(stdout[:-1], text)397    def test_normal_string(self):398        self._test_in_shell('abcd')399    def test_spaced_string(self):400        self._test_in_shell('abcd efgh')401    def test_dollar(self):402        self._test_in_shell('$')403    def test_single_quote(self):404        self._test_in_shell('\'')405    def test_single_quoted_string(self):406        self._test_in_shell('\'efgh\'')407    def test_string_with_single_quote(self):408        self._test_in_shell("a'b")409    def test_string_with_escaped_single_quote(self):410        self._test_in_shell(r"a\'b")411    def test_double_quote(self):412        self._test_in_shell('"')413    def test_double_quoted_string(self):...test_write.py
Source:test_write.py  
...8    def test_float(self):9        self.assertEqual(dumps(7.9), b'7.9,')10    def test_string(self):11        self.assertEqual(dumps('hey'), b'hey,')12    def test_spaced_string(self):13        self.assertEqual(dumps('hey glovebox'), b'"hey glovebox",')14    def test_escaped_string(self):15        self.assertEqual(dumps('do\\g'), b'do\\g,')16    def test_escaped_spaced_string(self):17        self.assertEqual(dumps('hey \\glovebox'), b'"hey \\\\glovebox",')18    def test_object(self):19        self.assertEqual(dumps({}), b'{},')20    def test_object_keys(self):21        self.assertIn(22            dumps({'dig': 'wombat', 'fig': 'combat'}),23            {24                b'{dig:wombat,fig:combat,},',25                b'{fig:combat,dig:wombat,},',26            })...test_utility_formatting.py
Source:test_utility_formatting.py  
...6    output = torchspy.utility.formatting.bytes_human_readable(num_bytes)7    assert output == expected_string8@pytest.mark.parametrize("spacings, expected_string",9                         (([4, 6], "I   am    hungry"), ([3, 4], "I  am  hungry")))10def test_spaced_string(spacings, expected_string):11    output = torchspy.utility.formatting.spaced_string("I", "am", "hungry", spacings=spacings)12    assert output == expected_string13def test_spaced_string_non_matching():14    with pytest.raises(ValueError):15        torchspy.utility.formatting.spaced_string("I", "am", "hungry", spacings=[1])16    with pytest.raises(ValueError):...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!!
