Best Python code snippet using green
assignment_statements_test.py
Source: assignment_statements_test.py
...30@dace.program31def multiple_targets(a: dace.float32[1]):32 b, c = a, 2 * a33 return b, c34def test_multiple_targets():35 a = np.zeros((1, ), dtype=np.float32)36 a[0] = np.pi37 b, c = multiple_targets(a=a)38 assert (b[0] == np.float32(np.pi))39 assert (c[0] == np.float32(2) * np.float32(np.pi))40@dace.program41def multiple_targets_parentheses(a: dace.float32[1]):42 (b, c) = (a, 2 * a)43 return b, c44def test_multiple_targets_parentheses():45 a = np.zeros((1, ), dtype=np.float32)46 a[0] = np.pi47 b, c = multiple_targets_parentheses(a=a)48 assert (b[0] == np.float32(np.pi))49 assert (c[0] == np.float32(2) * np.float32(np.pi))50@dace.program51def starred_target(a: dace.float32[1]):52 b, *c, d, e = a, 2 * a, 3 * a, 4 * a, 5 * a, 6 * a53 return b, c, d, e54@pytest.mark.skip55def test_starred_target():56 a = np.zeros((1, ), dtype=np.float32)57 a[0] = np.pi58 b, c, d, e = starred_target(a=a)59 assert (b[0] == np.float32(np.pi))60 assert (c[0] == np.float32(2) * np.float32(np.pi))61 assert (c[1] == np.float32(3) * np.float32(np.pi))62 assert (c[2] == np.float32(4) * np.float32(np.pi))63 assert (d[0] == np.float32(5) * np.float32(np.pi))64 assert (e[0] == np.float32(6) * np.float32(np.pi))65mystruct = dace.struct('mystruct', a=dace.int32, b=dace.float32)66@dace.program67def attribute_reference(a: mystruct[1]):68 a.a[0] = 569 a.b[0] = 670@pytest.mark.skip71def test_attribute_reference():72 a = np.ndarray((1, ), dtype=np.dtype(mystruct.as_ctypes()))73 attribute_reference(a=a)74 assert (a[0]['a'] == np.int32(5))75 assert (a[0]['b'] == np.float32(6))76@dace.program77def ann_assign_supported_type():78 a: dace.uint16 = 579 return a80def test_ann_assign_supported_type():81 a = ann_assign_supported_type()82 assert (a.dtype == np.uint16)83def test_assignment_to_nonexistent_variable():84 @dace.program85 def badprog(B: dace.float64):86 A[...] = B87 with pytest.raises(DaceSyntaxError):88 badprog.to_sdfg()89if __name__ == "__main__":90 test_single_target()91 test_single_target_parentheses()92 test_multiple_targets()93 test_multiple_targets_parentheses()94 # test_starred_target()95 # test_attribute_reference()96 test_ann_assign_supported_type()...
TestMultipleTargets.py
Source: TestMultipleTargets.py
...12 @skipIfHostIncompatibleWithRemote13 @expectedFailureAll(14 oslist=["windows", "freebsd"],15 bugnumber="llvm.org/pr20282")16 def test_multiple_targets(self):17 env = {self.dylibPath: self.getLLDBLibraryEnvVal()}18 self.driver_exe = self.getBuildArtifact("multi-target")19 self.buildDriver('main.cpp', self.driver_exe)20 self.addTearDownHook(lambda: os.remove(self.driver_exe))21 self.signBinary(self.driver_exe)22# check_call will raise a CalledProcessError if multi-process-driver doesn't return23# exit code 0 to indicate success. We can let this exception go - the test harness24# will recognize it as a test failure.25 if self.TraceOn():26 print("Running test %s" % self.driver_exe)27 check_call([self.driver_exe, self.driver_exe], env=env)28 else:29 with open(os.devnull, 'w') as fnull:30 check_call([self.driver_exe, self.driver_exe],...
Check out the latest blogs from LambdaTest on this topic:
It is essential for a team, when speaking about test automation, to take the time needed to think, analyze and try what will be the best tool, framework, and language that suits your team’s needs.
In this digital era, Continuous Integration and Continuous Deployment is closely aligned with software development and agile methodologies. Organizations deploy latest versions of software products every minute to ensure maximum competitive edge.
Test Coverage and Code coverage are the most popular methodologies for measuring the effectiveness of the code. Though these terms are sometimes used interchangeably since their underlying principles are the same. But they are not as similar as you may think. Many times, I have noticed the testing team and development team being confused over the use of these two terminologies. Which is why I thought of coming up with an article to talk about the differences between code coverage and test coverage in detail.
When someone develops a website, going live it’s like a dream come true. I have also seen one of my friends so excited as he was just about to launch his website. When he finally hit the green button, some unusual trend came suddenly into his notice. After going into details, he found out that the website has a very high bounce rate on Mobile devices. Thanks to Google Analytics, he was able to figure that out.
With an average global salary of $39k, PHP is one of the most popular programming languages in the developer community. It’s the language behind the most popular CMS, WordPress. It is in-use by 79% of total websites globally, including the most used social network- Facebook, the largest digital encyclopedia – Wikipedia, China’s news giant Xinhuanet, and Russia’s social network VK.com.
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!!