# Path: collectors/takeda/parser.py
# def parse_record(res):
# 
#     # Init data
#     data = {}
# 
#     # Parse rawdata
#     gpath = 'h1'
#     kpath = 'p.eyebrowbold'
#     vpath = 'p.eyebrowbold+*'
#     rawdata = _parse_data(res, gpath, kpath, vpath)
#     for group, key, value in rawdata:
# 
#         # General
# 
#         if key == 'compound':
#             value = value.split(',')
# 
#         # Recruitment
# 
#         if key == 'locations':
#             value = value.split(',')
# 
#         # Collect plain values
#         data[key] = value
# 
#     # Extract results URL
#     selector = '#results div a::attr(href)'
#     value = res.css(selector).extract_first()
#     if value:
#         url = urlparse.urljoin(res.url, value)
#         data['download_the_clinical_trial_summary'] = url
#     else:
#         try:
#             del data['download_the_clinical_trial_summary']
#         except KeyError:
#             pass
# 
#     # Create record
#     record = Record.create(res.url, data)
# 
#     return record


from collectors.takeda.parser import parse_record
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals



class TestTakedaParser(object):
    def test_download_the_clinical_trial_summary_contains_absolute_url(self, get_url):
        url = 'https://www.takedaclinicaltrials.com/browse/summary/TAK-648_101'
        response = get_url(url)


# Path: collectors/takeda/parser.py
# def parse_record(res):
# 
#     # Init data
#     data = {}
# 
#     # Parse rawdata
#     gpath = 'h1'
#     kpath = 'p.eyebrowbold'
#     vpath = 'p.eyebrowbold+*'
#     rawdata = _parse_data(res, gpath, kpath, vpath)
#     for group, key, value in rawdata:
# 
#         # General
# 
#         if key == 'compound':
#             value = value.split(',')
# 
#         # Recruitment
# 
#         if key == 'locations':
#             value = value.split(',')
# 
#         # Collect plain values
#         data[key] = value
# 
#     # Extract results URL
#     selector = '#results div a::attr(href)'
#     value = res.css(selector).extract_first()
#     if value:
#         url = urlparse.urljoin(res.url, value)
#         data['download_the_clinical_trial_summary'] = url
#     else:
#         try:
#             del data['download_the_clinical_trial_summary']
#         except KeyError:
#             pass
# 
#     # Create record
#     record = Record.create(res.url, data)
# 
#     return record


# Path: tests/collectors/takeda/test_parser.py
from collectors.takeda.parser import parse_record

# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals



class TestTakedaParser(object):
    def test_download_the_clinical_trial_summary_contains_absolute_url(self, get_url):
        url = 'https://www.takedaclinicaltrials.com/browse/summary/TAK-648_101'
        response = get_url(url)


        record = parse_record(response)