def test_months_view(self):
        self.clear_db()
        datetimes = [
            datetime.datetime(2000, 1, 1),
            datetime.datetime(2000, 1, 2),
            datetime.datetime(2000, 2, 3),
            datetime.datetime(2002, 2, 4),
        ]
        for date in datetimes:
            post = Post(title='t', markup='')
            post.datetime = date
            db.session.add(post)
            db.session.commit()

        months = Post.query.get_months()
        assert_equal(len(months), 3)
        assert_equal(months[0]['year'], 2002)
        assert_equal(months[0]['index'], 2)
        assert_equal(months[0]['count'], 1)
        assert_equal(months[2]['year'], 2000)
        assert_equal(months[2]['index'], 1)
        assert_equal(months[2]['count'], 2)
Test the month objects for the archive view
dataset/ETHPy150Open eugenkiss/Simblin/test/test_models.py/TestPosts.test_months_view