Reputation: 21
Suppose I have a class:
class Player(object):
def __init__(self):
self.goal = ''
@property
def goal(self):
return self.goal
Is it possible to write a unit test on the property goal
, given that it is not callable?
Upvotes: 1
Views: 762
Reputation: 39830
How about:
def test_goal_property(self):
dummy_player = Player()
self.assertEqual(dummy_player.goal, '')
or
def test_goal_property(self):
dummy_player = Player()
dummy_player.goal = 'something'
self.assertEqual(dummy_player.goal, 'something')
Upvotes: 4