Best Python code snippet using stestr_python
test_slowest.py
Source:test_slowest.py
...11# under the License.12from stestr.commands import slowest13from stestr.tests import base14class TestSlowest(base.TestCase):15 def test_format_times(self):16 times = [('test_id_a', 12.34), ('test_id_b', 1.34)]17 res = slowest.format_times(times)18 self.assertEqual([('test_id_a', '12.340'), ('test_id_b', ' 1.340')],19 res)20 def test_format_times_with_zero(self):21 times = [('test_id_a', 0), ('test_id_b', 1.34)]22 res = slowest.format_times(times)23 self.assertEqual([('test_id_a', '0.000'), ('test_id_b', '1.340')],24 res)25 def test_format_times_all_zero(self):26 times = [('test_id_a', 0), ('test_id_b', 0.00)]27 res = slowest.format_times(times)28 self.assertEqual([('test_id_a', '0.000'), ('test_id_b', '0.000')],29 res)
test_specio_format_times.py
Source:test_specio_format_times.py
...10 (367 * 86400, '1 year ago'),11 (3 * 365 * 86400, '3 years ago'),12]13@mark.parametrize('offset, expected', SCENARIOS)14def test_format_times(offset: float, expected: str):15 """Should return formatted time according to scenario expectation."""16 timestamp = time.time() - offset...
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!!