File size: 1,854 Bytes
9d54b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import json

from vcutils.vcell_pipeline.datamodels import Publication

testdata = '''
[ 
  {
    "pubKey": "161520376",
    "title": "Increasing complexity of the ras signaling pathway",
    "authors": [
      "Vojtek, A. B.",
      "Der, C. J."
    ],
    "year": 1998,
    "citation": "J Biol Chem 273 (32): 19925-19928.",
    "pubmedid": "9685325",
    "doi": "10.1074/jbc.273.32.19925",
    "endnoteid": "8",
    "url": "https://www.ncbi.nlm.nih.gov/pubmed/9685325",
    "wittid": "-1",
    "biomodelReferences": [
      {
        "bmKey": "7681482",
        "name": "Generic_Ras_cascade_1998",
        "ownerName": "CMC",
        "ownerKey": "2794180",
        "versionFlag": "0"
      }
    ],
    "mathmodelReferences": [],
    "date": "1998-08-07T00:00:00.000-04:00"
  },
  {
    "pubKey": "161440204",
    "title": "A minimal cascade model for the mitotic oscillator involving cyclin and cdc2 kinase",
    "authors": [
      "Goldbeter, A."
    ],
    "year": 1991,
    "citation": "Proc Natl Acad Sci U S A 1991. 88 (20): 9107-9111.",
    "pubmedid": "1833774",
    "doi": "10.1073/pnas.88.20.9107",
    "endnoteid": "2",
    "url": "https://www.ncbi.nlm.nih.gov/pubmed/1833774",
    "wittid": "-1",
    "biomodelReferences": [
      {
        "bmKey": "84982814",
        "name": "Goldbeter 1991 explicit",
        "ownerName": "Education",
        "ownerKey": "30625624",
        "versionFlag": "0"
      }
    ],
    "mathmodelReferences": [],
    "date": "1991-10-15T00:00:00.000-04:00"
  }
]
'''

def test_publication_serializations():
    jsonData = json.loads(testdata)
    pubs = [Publication(**jsonDict) for jsonDict in jsonData]

    assert pubs[0].pubKey == "161520376"
    assert pubs[0].biomodelReferences[0].bmKey == "7681482"
    assert pubs[1].pubKey == "161440204"
    assert pubs[1].biomodelReferences[0].bmKey == "84982814"