Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

removed global #48

Merged
merged 2 commits into from
Oct 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions tests/testBaseStateMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
import unittest
sys.path.append('../src')

test = 2
test = [2]


def setTest(value):
"""Set the test variable to the value specified"""
test[0] = value


def getTest():
"""Return the value of test variable"""
return test[0]


def everFalse():
Expand All @@ -23,15 +33,14 @@ def testPrint():

def setTestTo3():
"""Sets Test to 3"""
global test # Needed to modify global copy of globvar
print(test)
test = 3
print(test)
print(getTest())
setTest(3)
print(getTest())


def printTest():
"""Print Test"""
print("Test: ", test)
print("Test: ", getTest())


class TestBaseStateMachine(unittest.TestCase):
Expand Down Expand Up @@ -164,8 +173,7 @@ def test5(self):

def test6(self):
"""Test 6 for state machine"""
global test
test = 2
setTest(2)
sm = StateMachine("../sample/sample6.xml")

sm.LoadStateMachine()
Expand Down