# Path: tests/utils.py
# def temporary_file(content=None, mode=None, binary=False):


import unittest
    import numpy as np
from igraph import Graph, Edge, EdgeSeq, VertexSeq
from .utils import is_pypy

    def testUpdateAttributes(self):
        e = self.g.es[0]

        e.update_attributes(a=2)
        self.assertEqual(e["a"], 2)

        e.update_attributes([("a", 3), ("b", 4)], c=5, d=6)
        self.assertEqual(e.attributes(), dict(a=3, b=4, c=5, d=6))

        e.update_attributes(dict(b=44, c=55))
        self.assertEqual(e.attributes(), dict(a=3, b=44, c=55, d=6))

    def testPhantomEdge(self):
        e = self.g.es[self.g.ecount() - 1]
        e.delete()

        # v is now a phantom edge; try to freak igraph out now :)
        self.assertRaises(ValueError, e.update_attributes, a=2)
        self.assertRaises(ValueError, e.__getitem__, "a")
        self.assertRaises(ValueError, e.__setitem__, "a", 4)
        self.assertRaises(ValueError, e.__delitem__, "a")
        self.assertRaises(ValueError, e.attributes)
        self.assertRaises(ValueError, getattr, e, "source")
        self.assertRaises(ValueError, getattr, e, "source_vertex")
        self.assertRaises(ValueError, getattr, e, "target")
        self.assertRaises(ValueError, getattr, e, "target_vertex")
        self.assertRaises(ValueError, getattr, e, "tuple")
        self.assertRaises(ValueError, getattr, e, "vertex_tuple")


# Path: tests/utils.py
# def temporary_file(content=None, mode=None, binary=False):


# Path: tests/test_edgeseq.py
import unittest
    import numpy as np
from igraph import Graph, Edge, EdgeSeq, VertexSeq
from .utils import is_pypy


    def testUpdateAttributes(self):
        e = self.g.es[0]

        e.update_attributes(a=2)
        self.assertEqual(e["a"], 2)

        e.update_attributes([("a", 3), ("b", 4)], c=5, d=6)
        self.assertEqual(e.attributes(), dict(a=3, b=4, c=5, d=6))

        e.update_attributes(dict(b=44, c=55))
        self.assertEqual(e.attributes(), dict(a=3, b=44, c=55, d=6))

    def testPhantomEdge(self):
        e = self.g.es[self.g.ecount() - 1]
        e.delete()

        # v is now a phantom edge; try to freak igraph out now :)
        self.assertRaises(ValueError, e.update_attributes, a=2)
        self.assertRaises(ValueError, e.__getitem__, "a")
        self.assertRaises(ValueError, e.__setitem__, "a", 4)
        self.assertRaises(ValueError, e.__delitem__, "a")
        self.assertRaises(ValueError, e.attributes)
        self.assertRaises(ValueError, getattr, e, "source")
        self.assertRaises(ValueError, getattr, e, "source_vertex")
        self.assertRaises(ValueError, getattr, e, "target")
        self.assertRaises(ValueError, getattr, e, "target_vertex")
        self.assertRaises(ValueError, getattr, e, "tuple")
        self.assertRaises(ValueError, getattr, e, "vertex_tuple")


    @unittest.skipIf(is_pypy, "skipped on PyPy because we do not have access to docstrings")