Best Python code snippet using autotest_python
test_http_proxy_to_wsgi.py
Source:test_http_proxy_to_wsgi.py
...22 def fake_app(req):23 return util.application_uri(req.environ)24 self.middleware = http_proxy_to_wsgi.HTTPProxyToWSGI(fake_app)25 self.request = webob.Request.blank('/foo/bar', method='POST')26 def test_backward_compat(self):27 @webob.dec.wsgify()28 def fake_app(req):29 return util.application_uri(req.environ)30 self.middleware = http_proxy_to_wsgi.HTTPProxyToWSGIMiddleware(31 fake_app)32 response = self.request.get_response(self.middleware)33 self.assertEqual(b"http://localhost:80/", response.body)34 def test_no_headers(self):35 response = self.request.get_response(self.middleware)36 self.assertEqual(b"http://localhost:80/", response.body)37 def test_url_translate_ssl(self):38 self.request.headers['X-Forwarded-Proto'] = "https"39 response = self.request.get_response(self.middleware)40 self.assertEqual(b"https://localhost:80/", response.body)...
test_header_clusters.py
Source:test_header_clusters.py
...13 ROUND_DECIMALS = 414 tmp = pd.read_csv(dataset_path, low_memory=False)15 tmp = tmp.round(ROUND_DECIMALS)16 return tmp17def test_backward_compat(sample_df):18 old_clusters = hc.cluster(sample_df)19 new_clusters = hc.cluster(sample_df, average_record_length_threshold=250.0)20 assert len(old_clusters) != len(new_clusters)21 assert new_clusters == [["label"], ["text"], ["title"]]22 assert old_clusters == [["label", "text", "title"]]23def test_no_empty_clusters(sample_df):24 clusters = hc.cluster(sample_df, average_record_length_threshold=250.0)25 assert [] not in clusters26# sample_df doesn't have any fields that should be single batched, so independent of isolation flag, clusters should be the same27def test_no_isolation(sample_df):28 old_clusters = hc.cluster(sample_df, maxsize=20, isolate_complex_field=False)29 new_clusters = hc.cluster(sample_df, maxsize=20)30 assert len(old_clusters) == len(new_clusters)31 assert old_clusters == new_clusters...
test_day05.py
Source:test_day05.py
...18 program_input = [int(x) for x in content.split(',')]19 the_outputs = run_program(program_input)20 self.assertEqual(the_outputs[-1], 9431221)21 @patch('builtins.input', lambda x: 1)22 def test_backward_compat(self):23 with open('data/input05_github_login.txt') as f:24 content = f.read()25 program_input = [int(x) for x in content.split(',')]26 the_outputs = rp9(program_input)[1]...
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!!