Reputation: 804
I'm trying to increase my-test-code-coverage percentage in a Django app. I'm typically using coverage.py(http://nedbatchelder.com/code/coverage/)
For models i couldn't see higher values than %88 for "django poll tutorial". Here is my tests.py : http://pastebin.com/TBs9jnR3
and run:
$ coverage -e
$ coverage -x manage.py test polls
$ coverage -r -m
here is result: http://pastebin.com/MzCYmyAE
So What is the optimum way to test CRUD operations??
Upvotes: 1
Views: 732
Reputation: 804
adding lines:
self.assertEqual(self.poll.__unicode__(),self.poll.question)
self.assertEqual(self.choice_list[0].__unicode__(),self.choice_list[0].choice)
solved my problem
self.assertEqual(self.choice_list[0].choice,"Miles")
is seems that not enough to test unicode trick. :) now its %100 Test Code Coverage
Upvotes: 1