Archived
1
0

Added test for empty values on properties in ACD/Labs tab

This commit is contained in:
RTB 2014-04-29 16:30:09 +02:00
parent 81886981a3
commit 971552110a

View File

@ -47,7 +47,6 @@ class ChemSpider(Source):
properties = [] properties = []
# Predicted - ACD/Labs tab # Predicted - ACD/Labs tab
# [TODO] - test if tab contains data, some chemicals do not have data here
td_list = sel.xpath('.//table[@id="acdlabs-table"]//td').xpath( td_list = sel.xpath('.//table[@id="acdlabs-table"]//td').xpath(
'normalize-space(string())') 'normalize-space(string())')
prop_names = td_list[::2] prop_names = td_list[::2]
@ -58,6 +57,12 @@ class ChemSpider(Source):
prop_value = prop_value.extract().encode('utf-8') prop_value = prop_value.extract().encode('utf-8')
prop_conditions = '' prop_conditions = ''
# Test for properties without values, with one hardcoded exception
if (not re.match(r'^\d', prop_value) or
(prop_name == 'Polarizability' and
prop_value == '10-24cm3')):
continue
# Match for condition in parentheses # Match for condition in parentheses
m = re.match(r'(.*) \((.*)\)', prop_name) m = re.match(r'(.*) \((.*)\)', prop_name)
if m: if m: