Exemple #1
0
 def test_translate_species_with_author(self):
     "accept one string, return one value"
     
     input = """$
             Psychotria thyrsiflora Ruiz & Pav. 
 Psychotria thyrsiflora Ruiz & Pav. = Palicourea thyrsiflora (Ruiz & Pav.) DC.
             Reference: FP 1365: 226. 
            $"""
     #invoke the function we did not yet write
     result=taxonlist2json.convert(input)
     #the object we expect
     expect = {"rank": "Species",
               "epithet": "thyrsiflora",
               "ht-rank": "genus",
               "ht-epitheth": "Psychotria",
               "hybrid": "false",
               "author": "Ruiz & Pav."}  # tambien lo vimos ayer
     self.assertEquals(result, expect)
 def test_translate_species_with_author(self):
     "accept one string, return one value"
     
     input = """$
             Psychotria thyrsiflora Ruiz & Pav. 
 Psychotria thyrsiflora Ruiz & Pav. = Palicourea thyrsiflora (Ruiz & Pav.) DC.
             Reference: FP 1365: 226. 
            $"""
     #invoke the function we did not yet write
     result=taxonlist2json.convert(input)
     #the object we expect
     expect = {"rank": "Species",
           "epithet": "thyrsiflora",
           "ht-rank": "genus",
           "ht-epitheth": "Psychotria",
           "hybrid": "false",
           "author": "Ruiz & Pav."} # tambien lo vimos ayer
     self.assertEquals(result, expect)
    def test_file_to_elements(self):
        s = '''\
$


 Aa brevis Schltr.


Aa brevis Schltr. = Myrosmodes breve (Schltr.) Garay

Reference: FP 1438: 102; Garay, L. A., 1978: 168; Dodson, C. H., 1992: xx.


$


 Aa calceata (Rchb. f.) Schltr.



Aa calceata (Rchb. f.) Schltr.

Synonyms: Aa calceata Rchb. f.
Reference: Flora Peru: 1438: 94; Dodson, pers. comm..
Note: Not reconfirmed.


$


 Aa chiogena Schltr.


Aa chiogena Schltr. = Myrosmodes chiogena (Schltr.)

Reference: FP 1438: 94.


$\
'''
        result = taxonlist2json.convert(s)
        self.assertEquals(len(result), 3)
    def test_file_to_elements(self):
        s = '''\
$


 Aa brevis Schltr.


Aa brevis Schltr. = Myrosmodes breve (Schltr.) Garay

Reference: FP 1438: 102; Garay, L. A., 1978: 168; Dodson, C. H., 1992: xx.


$


 Aa calceata (Rchb. f.) Schltr.



Aa calceata (Rchb. f.) Schltr.

Synonyms: Aa calceata Rchb. f.
Reference: Flora Peru: 1438: 94; Dodson, pers. comm..
Note: Not reconfirmed.


$


 Aa chiogena Schltr.


Aa chiogena Schltr. = Myrosmodes chiogena (Schltr.)

Reference: FP 1438: 94.


$\
'''
        result = taxonlist2json.convert(s)
        self.assertEquals(len(result), 3)