def test_when_upcoming(self) : state = { 'alice' : {'s' : 5, 'e' : 10}, 'bob' : {'s' : 7, 'e' : 12} } self.assertEquals(dudeutils.when(state, 1, count=1), "alice will be here in 4 seconds.") self.assertEquals(dudeutils.when(state, 5, count=1), "alice will be here in a jiffy.")
def test_when_unsetup_user(self) : state = {'jim' : {}} self.assertEquals(dudeutils.when(state, 5), "The only thing I know is that I know nothing.")
def test_when_past_leaving(self) : state = {'jim' : {'s' : 5L, 'e' : 10L}} self.assertEquals(dudeutils.when(state, 11), "jim left 1 second ago.")
def test_when_future_leaving(self) : state = {'jim' : {'s' : 5, 'e' : 10}} self.assertEquals(dudeutils.when(state, 8), "jim will leave in 2 seconds.")
def test_when_ennui(self) : state = {} self.assertEquals(dudeutils.when(state, 3), "The only thing I know is that I know nothing.")
def test_when_talk_about_each_person_once(self) : state = { 'alice' : {'s' : 3, 'e' : 4}, 'bob' : {'s' : 8, 'e' : 12} } self.assertEquals(dudeutils.when(state, 5, count=2), "alice left 1 second ago and bob will be here in 3 seconds.")
def test_when_past_and_future(self) : state = { 'alice' : {'s' : 5, 'e' : 10}, 'bob' : {'s' : 7, 'e' : 12} } self.assertEquals(dudeutils.when(state, 8, count=2), "bob got here 1 second ago and alice will leave in 2 seconds.")