Skip to content

Instantly share code, notes, and snippets.

View jamescooke's full-sized avatar
🤓
Testing all the things

James Cooke jamescooke

🤓
Testing all the things
View GitHub Profile
@jamescooke
jamescooke / NOTES.rst
Last active September 27, 2015 11:29
PyConUK sprint on improving output from unittest when `assertEqual` finds non-matching values.

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

@jamescooke
jamescooke / test_assert_q_equal.py
Created March 28, 2016 10:25
Tests on `assertQEquals` assertion helper. Full blog post at http://jamescooke.info/comparing-django-q-objects.html
# 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 / test_assert_q_equal.py
Last active June 4, 2017 09:26
Tests on Django Q object assertion helper
# 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.