def test_comment_creation_and_listing(self): p1 = Person('1234', repository=self.repo) comments = p1.get_comments() self.assertEqual(comments.count(), 0) comment_text = "This bio is really accurate!" p1.add_comment(text=comment_text) comments = p1.get_comments() self.assertEqual(comments.count(), 1) self.assertEqual(comments[0].text, comment_text) self.assertEqual(comments[0].created.toordinal(), datetime.now().toordinal()) self.assertEqual(comments[0].submitter, 'Anonymous') p1.add_comment(text=comment_text + ' is not true!')
def test_are_dates_different(self): # false pairs = [("1877-02-26", "bioport"), ("1877", "bwn"), ] self.assertFalse(Person._are_dates_different(pairs)) pairs = [("1877-02", "bioport"), ("1877", "bwn"), ] self.assertFalse(Person._are_dates_different(pairs)) pairs = [("1877-02-26", "bioport"), ("1877-02-26", "foo"), ("1877", "bwn"), ("1877", "bar"), ] self.assertFalse(Person._are_dates_different(pairs)) # true pairs = [("1877-02-26", "bioport"), ("1877-02-27", "bioport"), ("1877", "bwn"), ] self.assertTrue(Person._are_dates_different(pairs)) pairs = [("1877-02-26", "bioport"), ("1877-02-26", "bioport"), ("1876", "bwn"), ] self.assertTrue(Person._are_dates_different(pairs))