'Tests that the graph is really a triangular lattice.'

def test_lattice_points(self):

    for (m, n) in [(2, 3), (2, 2), (2, 1), (3, 3), (3, 2), (3, 4)]:
        G = nx.triangular_lattice_graph(m, n)
        N = ((n + 1) // 2)
        assert_equal(len(G), (((m + 1) * (1 + N)) - ((n % 2) * ((m + 1) // 2))))
    for (i, j) in G.nodes():
        nbrs = G[(i, j)]
        if (i < N):
            assert_true((((i + 1), j) in nbrs))
        if (j < m):
            assert_true(((i, (j + 1)) in nbrs))
        if ((j < m) and ((i > 0) or (j % 2)) and ((i < N) or ((j + 1) % 2))):
            assert_true(((((i + 1), (j + 1)) in nbrs) or (((i - 1), (j + 1)) in nbrs)))
