test_file_io   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_dumps() 0 34 1
1
from goblin import element
2
from goblin.fileio.graphson import dump, dumps, AdjList
3
4
import pytest
5
6
7
# def test_dump_simple_vertex(person):
8
#     person.id = 1
9
#     person.name = 'dave'
10
#     person.age = 37
11
#     person.birthplace = 'Iowa City'
12
#     # import ipdb; ipdb.set_trace()
13
#     person.nicknames = ['davebshow', 'crustee']
14
#     person.location = 'London, ON'
15
#     person.location('London, ON').year = 2010
16
#     dumped = dumps(person)
17
#     print(dumped)
18
19
20
@pytest.mark.skip(reason="Test not working on all backends")
21
def test_dumps(person_class, knows_class):
22
    person = person_class()
23
    person.id = 1
24
    person.name = 'dave'
25
    person.age = 37
26
    person.birthplace = 'Iowa City'
27
    # import ipdb; ipdb.set_trace()
28
    person.nicknames = ['davebshow', 'crustee']
29
    person.location = 'London, ON'
30
    person.location('London, ON').year = 2010
31
32
    person2 = person_class()
33
    person2.id = 2
34
    person2.name = 'itziri'
35
    person2.age = 37
36
    person2.birthplace = 'London'
37
    # import ipdb; ipdb.set_trace()
38
    person2.nicknames = ['chong', 'itsilly']
39
    person2.location = 'Tacoma'
40
    person2.location('Tacoma').year = 2018
41
42
    knows = knows_class()
43
    knows.source = person
44
    knows.target = person2
45
    knows.notes = "married"
46
    knows.id = 3
47
48
    al1 = AdjList(vertex=person, inE=[], outE=[knows])
49
    al2 = AdjList(vertex=person2, inE=[knows], outE=[])
50
51
    print(dumps(al1))
52
    print(dumps(al2))
53
    dump('test_graph.json', al1, al2)
54