@@ -1588,6 +1588,14 @@ def test_load_template_to_dataframe_column_with_nas(self):
1588
1588
exp .index .name = 'sample_name'
1589
1589
assert_frame_equal (obs , exp )
1590
1590
1591
+ def test_load_template_to_dataframe_exception (self ):
1592
+ with self .assertRaises (QiitaDBColumnError ):
1593
+ x = load_template_to_dataframe (
1594
+ StringIO (SAMPLE_TEMPLATE_NO_SAMPLE_NAME ))
1595
+
1596
+ # prevent flake8 from complaining
1597
+ x .strip ()
1598
+
1591
1599
def test_get_invalid_sample_names (self ):
1592
1600
all_valid = ['2.sample.1' , 'foo.bar.baz' , 'roses' , 'are' , 'red' ,
1593
1601
'v10l3t5' , '4r3' , '81u3' ]
@@ -1790,6 +1798,21 @@ def test_get_get_invalid_sample_names_mixed(self):
1790
1798
"True\t NotIdentified\t 4.8\t 4.41\t location1\t received\t type1\t "
1791
1799
"NA\n " )
1792
1800
1801
+ SAMPLE_TEMPLATE_NO_SAMPLE_NAME = (
1802
+ ":L}={\t collection_timestamp\t description\t has_extracted_data\t "
1803
+ "has_physical_specimen\t host_subject_id\t latitude\t longitude\t "
1804
+ "physical_location\t required_sample_info_status\t sample_type\t "
1805
+ "str_column\n "
1806
+ "2.Sample1\t 2014-05-29 12:24:51\t Test Sample 1\t True\t True\t "
1807
+ "NotIdentified\t 42.42\t 41.41\t location1\t received\t type1\t "
1808
+ "NA\n "
1809
+ "2.Sample2\t 2014-05-29 12:24:51\t "
1810
+ "Test Sample 2\t True\t True\t NotIdentified\t 4.2\t 1.1\t location1\t received\t "
1811
+ "type1\t NA\n "
1812
+ "2.Sample3\t 2014-05-29 12:24:51\t Test Sample 3\t True\t "
1813
+ "True\t NotIdentified\t 4.8\t 4.41\t location1\t received\t type1\t "
1814
+ "NA\n " )
1815
+
1793
1816
SAMPLE_TEMPLATE_DICT_FORM = {
1794
1817
'collection_timestamp' : {'2.Sample1' : '2014-05-29 12:24:51' ,
1795
1818
'2.Sample2' : '2014-05-29 12:24:51' ,
0 commit comments