def assert_angles_allclose(x, y, **kwargs):
    """
    Like numpy's assert_allclose, but for angles (in radians).
    """
    c2 = (np.sin(x)-np.sin(y))**2 + (np.cos(x)-np.cos(y))**2
    diff = np.arccos((2.0 - c2)/2.0) # a = b = 1
    assert np.allclose(diff, 0.0, **kwargs)
Like numpy's assert_allclose, but for angles (in radians).