Best Python code snippet using fMBT_python
setupJavaAwt.py
Source:setupJavaAwt.py
1# This program may be used, executed, copied, modified and distributed2# without royalty for the purpose of developing, using, marketing, or distributing.3#4# setupJavaAwt - sets the java.awt.headless property to true for the dmgr5#6print "testing to make sure java.awt.headless property is set on the dmgr"7# Setting up constants8maximumHeapSize = 5129dmgr = AdminConfig.getid("/Server:dmgr")10if (dmgr != ""):11 processDef = AdminConfig.showAttribute(dmgr,"processDefinitions")12 processDef = processDef[1:len(processDef)-1]13 jvmEntries = AdminConfig.showAttribute(processDef,"jvmEntries")14 jvmEntries = jvmEntries[1:len(jvmEntries)-1]15 currentMaxHeap = AdminConfig.showAttribute(jvmEntries,"maximumHeapSize")16 if (currentMaxHeap < maximumHeapSize):17 AdminConfig.modify(jvmEntries,[["maximumHeapSize", maximumHeapSize]])18 systemProperties = AdminConfig.showAttribute(jvmEntries,"systemProperties")19 systemProperties = systemProperties[1:len(systemProperties)-1]20 systemProperties = systemProperties.rstrip().split(" ")21 foundheadless=022 print "existing system properties:"23 for systemProperty in systemProperties:24 systemProperty = systemProperty.rstrip()25 if (systemProperty !=""):26 name = AdminConfig.showAttribute(systemProperty,"name")27 value = AdminConfig.showAttribute(systemProperty,"value")28 print "\t"+name+"="+value29 if (name == "java.awt.headless"):30 foundheadless=131 break32 if (foundheadless==0):33 AdminConfig.create("Property",jvmEntries,[["name","java.awt.headless"],["value","true"]])34 print "adding java.awt.headless=true"35 print "saving workspace"36 AdminConfig.save()...
test_system.py
Source:test_system.py
1import pytest2from app import PropertyError3from app.controller.systems import SystemProperty4from app.model.character import Character5from app.model.images import ScreenImages6from app.model.visual import Clock7def test_system_images(system_property: SystemProperty) -> None:8 assert isinstance(system_property.images(), ScreenImages)9def test_system_character(system_property: SystemProperty) -> None:10 assert isinstance(system_property.character(), Character)11def test_system_clock(system_property: SystemProperty) -> None:12 assert isinstance(system_property.clock(), Clock)13def test_system_empty_bullets(system_property: SystemProperty) -> None:14 assert not system_property.bullets()15def test_system_is_run(system_property: SystemProperty) -> None:16 assert system_property.is_run is True17def test_set_system_is_run(system_property: SystemProperty) -> None:18 system_property.is_run = False19 assert system_property.is_run is False20def test_set_error_system_is_run(system_property: SystemProperty) -> None:21 with pytest.raises(PropertyError):22 system_property.is_run = None23def test_system_last_move(system_property: SystemProperty) -> None:24 assert system_property.last_move == "right"25def test_set_system_last_move(system_property: SystemProperty) -> None:26 system_property.last_move = "left"27 assert system_property.last_move == "left"28def test_set_error_system_last_move(system_property: SystemProperty) -> None:29 with pytest.raises(PropertyError):...
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!!