-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_parse.py
More file actions
40 lines (31 loc) · 869 Bytes
/
test_parse.py
File metadata and controls
40 lines (31 loc) · 869 Bytes
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
from xml_parser import *
from pathlib import Path
from pprint import PrettyPrinter
import pytest
pp = PrettyPrinter(indent=2)
test_xml = [
Path("archive/NCT0000xxxx/NCT00005907.xml"),
Path("archive/NCT0000xxxx/NCT00005908.xml"),
]
def test_main_schema():
"""
This function tests the main_schema_dict function for the xml_parser.py
"""
for i in test_xml:
try:
dict0 = extract_xml(i)
except UnicodeError:
return None
main_dict = main_schema_dict(dict0)
pp.pprint(main_dict)
def test_drug_schema():
"""
This function tests the drug_schema_dict function for the xml_parser.py
"""
for i in test_xml:
dict0 = extract_xml(i)
drug_dict = drug_schema_dict(dict0)
for i in drug_dict:
pp.pprint(i)
# test_main_schema();
test_drug_schema();