Improve assertion for django 1.7 and python 3