def test_tag_associations(self):
        self.clear_db()
        db.session.add(Category('cool'))
        db.session.add(Category('cooler'))
        db.session.commit()
        post1 = Post(title='t', markup='')
        post1.categories = [1]
        post2 = Post(title='t2', markup='')
        post2.categories = [1, 2]
        db.session.add(post1)
        db.session.add(post2)
        db.session.commit()
        
        assert_equal(Category.query.get(1).posts.count(), 2) # cool
        assert_equal(Category.query.get(2).posts.count(), 1) # cooler
        assert_equal(len(post1.categories), 1)
        assert_equal(post1.categories[0].name, 'cool')
        assert_equal(len(post2.categories), 2)
        assert_equal(post2.categories[0].name, 'cool')
        assert_equal(post2.categories[1].name, 'cooler')
Test if categories and posts are correctly associated with 
dataset/ETHPy150Open eugenkiss/Simblin/test/test_models.py/TestCategories.test_tag_associations