Skip to content

Instantly share code, notes, and snippets.

🤓
Testing all the things

James Cooke jamescooke

View GitHub Profile
@jamescooke
jamescooke / test_assert_q_equal.py
Last active Jun 4, 2017
Tests on Django Q object assertion helper
View test_assert_q_equal.py
# encoding: utf-8
import pytest
from django.db.models import Q
def assert_q_equal(left, right):
"""
Simply test two Q objects for equality. Does is not match commutative.
@jamescooke
jamescooke / test_assert_q_equal.py
Created Mar 28, 2016
Tests on `assertQEquals` assertion helper. Full blog post at http://jamescooke.info/comparing-django-q-objects.html
View test_assert_q_equal.py
# encoding: utf-8
from __future__ import unicode_literals
from django.db.models import Q
from django.test import TestCase
from .helpers import QTestMixin
@jamescooke
jamescooke / NOTES.rst
Last active Sep 27, 2015
PyConUK sprint on improving output from unittest when `assertEqual` finds non-matching values.
View NOTES.rst

Unittest documentation improvements

http://www.pyconuk.org/sprints/unit-test-documentation-improvements/

We explored where the "Expected: 1, actual: 2" messages (used to) come from in unittest. We found that this code has already been improved back in 2011. Why were we still getting old output for so long?

Below are links to our findings, plus you can see the test cases we built and

You can’t perform that action at this time.