File: test_clear.py

package info (click to toggle)
python-pygraphviz 1.3.1-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 664 kB
  • sloc: ansic: 4,970; python: 2,523; makefile: 152
file content (31 lines) | stat: -rw-r--r-- 936 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
from nose.tools import *
import pygraphviz as pgv


def test_del():
    A = pgv.AGraph()
    A.add_node(1,foo='bar')
    # For some reasons after porting to Python 3 clear often cause infinite loop
    A.delete_node('1')
    assert_equal(len(A), 0)

def test_clear_node_with_attributes():
    A = pgv.AGraph()
    A.add_node(1,foo='bar')
    # For some reasons after porting to Python 3 clear often cause infinite loop
    A.clear()
    assert_equal(len(A), 0)
    assert_equal(A.nodes(), [])
    assert_equal(A.node_attr.keys(), [])

def test_clear_graph_attributes():
    A = pgv.AGraph()
    A.add_node(1,foo='bar')
    A.graph_attr.update(landscape='true',ranksep='0.1')
    # For some reasons after porting to Python 3 clear often cause infinite loop
    A.clear()
    assert_equal(len(A), 0)
    assert_equal(A.nodes(), [])
    assert_equal(A.node_attr.keys(), [])
    assert_equal(A.graph_attr.keys(), [])