Skip to content

Commit

Permalink
removed global (#48)
Browse files Browse the repository at this point in the history
* removed global

* docstring added
  • Loading branch information
rupesh-dharme authored Oct 7, 2021
1 parent 0b1c356 commit 4ae032d
Showing 1 changed file with 16 additions and 8 deletions.
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

0 comments on commit 4ae032d

Please # to comment.