Skip to content

Commit

Permalink
extra check on bonds, removing old Start script
Browse files Browse the repository at this point in the history
  • Loading branch information
morgajel committed Sep 6, 2014
1 parent 29d9c77 commit 937bd66
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 0 additions & 3 deletions Start

This file was deleted.

3 changes: 0 additions & 3 deletions megacosm/generators/bond.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@


class Bond(Generator):

"""Generate a bond between two people 'you' and 'other'."""

def __init__(self, redis, features={}):
Generator.__init__(self, redis, features)
self.logger = logging.getLogger(__name__)

# if self.you and self.other are not set, set them to defaults.

if not hasattr(self, 'you'):
self.you = 'you'

# a random NPC

if not hasattr(self, 'other'):
self.other = npc.NPC(self.redis).name['full']

Expand Down
13 changes: 12 additions & 1 deletion tests/test_bond.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ def test_bond_features(self):
'bond_when_roll': 5,
'when': 'Bob',
})
self.assertEqual(bond.text, 'Bob, Jesse Will Tony Shaun Rich')
self.assertEqual('Bob, Jesse Will Tony Shaun Rich', bond.text)
self.assertEqual('Bob, Jesse Will Tony Shaun Rich', "%s" % bond)

def test_bond_non_features(self):
""" """
bond = Bond(self.redis, {
'bond_when_roll': 100,
'template': 'Bob, Jesse Will Tony Shaun Rich',
})

self.assertEqual('Bob, Jesse Will Tony Shaun Rich', bond.text)
self.assertEqual('Bob, Jesse Will Tony Shaun Rich', "%s" % bond)

1 comment on commit 937bd66

@satthawut
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.