Best Python code snippet using avocado_python
test_oracle_jdk.py
Source: test_oracle_jdk.py
1import mock2import unittest3class OracleJdkTestCase(unittest.TestCase):4 @mock.patch('fabtools.oracle_jdk.get_arch')5 def test_jdk_arch_for_x64_system(self, get_arch):6 from fabtools.oracle_jdk import _required_jdk_arch7 get_arch.return_value = 'x86_64'8 self.assertEqual('x64', _required_jdk_arch())9 @mock.patch('fabtools.oracle_jdk.get_arch')10 def test_jdk_arch_for_32bit_system(self, get_arch):11 from fabtools.oracle_jdk import _required_jdk_arch12 for system_arch in ['i386', 'i486', 'i586', 'i686']:13 get_arch.return_value = system_arch14 self.assertEqual('i586', _required_jdk_arch())15 @mock.patch('fabtools.oracle_jdk.get_arch')16 def test_jdk_arch_for_unknown_system(self, get_arch):17 from fabtools.oracle_jdk import _required_jdk_arch18 get_arch.return_value = 'unknown'19 self.assertRaises(Exception, _required_jdk_arch)20 def test_jdk_version_with_update_over_ten(self):21 from fabtools.oracle_jdk import _extract_jdk_version22 java_version_out = '''java version "1.7.0_13"23Java(TM) SE Runtime Environment (build 1.7.0_13-b20)24Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode)25'''26 self.assertEqual('7u13-b20', _extract_jdk_version(java_version_out))27 def test_jdk_version_with_update_under_ten(self):28 from fabtools.oracle_jdk import _extract_jdk_version29 java_version_out = '''java version "1.7.0_09"30Java(TM) SE Runtime Environment (build 1.7.0_09-b05)31Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)32'''33 self.assertEqual('7u9-b05', _extract_jdk_version(java_version_out))34 def test_jdk_version_with_openjdk(self):35 from fabtools.oracle_jdk import _extract_jdk_version36 java_version_out = '''java version "1.7.0_21"37OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-0ubuntu0.12.04.1)38OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)39'''...
__init__.py
Source: __init__.py
...20 """ Try to get the architecture for the current platform """21 if sys.platform.startswith("win"):22 machine = platform.machine()23 if machine == "AMD64":24 return get_arch("x86_64:wincc")25 elif sys.platform == "linux":26 if platform.architecture()[0] == "64bit":27 return get_arch("x86_64")28def get_arch(arch):29 """ Try to return an architecture instance.30 Args:31 arch: can be a string in the form of arch:option1:option232 .. doctest::33 >>> from ppci.api import get_arch34 >>> arch = get_arch('msp430')35 >>> arch36 msp430-arch37 >>> type(arch)38 <class 'ppci.arch.msp430.arch.Msp430Arch'>39 """40 if isinstance(arch, Architecture):41 return arch42 elif isinstance(arch, str):43 # Horrific import cycle created. TODO: restructure this44 from .target_list import create_arch45 if ":" in arch:46 # We have target with options attached47 parts = arch.split(":")48 return create_arch(parts[0], options=tuple(parts[1:]))...
Check out the latest blogs from LambdaTest on this topic:
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.
JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.
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!!