dimus-biodiversity 0.0.13 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,10 @@ describe ScientificNameDirty do
28
28
  parse(input).details
29
29
  end
30
30
 
31
+ def pos(input)
32
+ parse(input).pos
33
+ end
34
+
31
35
  it 'should parse clean names' do
32
36
  parse("Betula verucose (L.) Bar. 1899").should_not be_nil
33
37
  end
@@ -37,27 +41,35 @@ describe ScientificNameDirty do
37
41
  value("Anthoscopus Cabanis [185?]").should == "Anthoscopus Cabanis (185?)"
38
42
  parse("Anthoscopus Cabanis [1851?]").should_not be_nil
39
43
  value("Anthoscopus Cabanis [1851]").should == "Anthoscopus Cabanis (1851)"
40
- value("Anthoscopus Cabanis [1851?]").should == "Anthoscopus Cabanis (1851?)"
41
- details("Anthoscopus Cabanis [1851?]").should == {:uninomial=>"Anthoscopus", :authors=>{:names=>["Cabanis"], :approximate_year=>"(1851?)"}, :name_part_verbatim=>"Anthoscopus", :auth_part_verbatim=>"Cabanis [1851?]"}
42
-
43
- parse("Trismegistia monodii Ando, 1973 [1974]").should_not be_nil
44
- details("Trismegistia monodii Ando, 1973 [1974]").should == {:genus=>"Trismegistia", :species=>"monodii", :authors=>{:names=>["Ando"], :ambiguous_year=>"1973 [1974]"}, :name_part_verbatim=>"Trismegistia monodii", :auth_part_verbatim=>"Ando, 1973 [1974]"}
44
+ sn = "Anthoscopus Cabanis [1851?]"
45
+ value(sn).should == "Anthoscopus Cabanis (1851?)"
46
+ details(sn).should == {:uninomial=>"Anthoscopus", :authors=>{:names=>["Cabanis"], :approximate_year=>"(1851?)"}, :name_part_verbatim=>"Anthoscopus", :auth_part_verbatim=>"Cabanis [1851?]"}
47
+ pos(sn).should == {0=>["uninomial", 11], 12=>["author_word", 19], 21=>["year", 26]}
48
+ sn = "Trismegistia monodii Ando, 1973 [1974]"
49
+ parse(sn).should_not be_nil
50
+ value(sn).should == 'Trismegistia monodii Ando 1973 [1974]' #should it be 'Trismegistia monodii Ando 1973 (1974)' instead?
51
+ details(sn).should == {:genus=>"Trismegistia", :species=>"monodii", :authors=>{:names=>["Ando"], :ambiguous_year=>"1973 [1974]"}, :name_part_verbatim=>"Trismegistia monodii", :auth_part_verbatim=>"Ando, 1973 [1974]"}
52
+ pos(sn).should == {0=>["genus", 12], 13=>["species", 20], 21=>["author_word", 25], 27=>["year", 31], 33=>["year", 37]}
45
53
  parse("Zygaena witti Wiegel [1973]").should_not be_nil
46
- parse("Deyeuxia coarctata Kunth, 1815 [1816]").should_not be_nil
54
+ sn = "Deyeuxia coarctata Kunth, 1815 [1816]"
55
+ parse(sn).should_not be_nil
56
+ pos(sn).should == {0=>["genus", 8], 9=>["species", 18], 19=>["author_word", 24], 26=>["year", 30], 32=>["year", 36]}
47
57
  end
48
58
 
49
59
  it 'should parse year with page number' do
50
- val = "Gymnodactylus irregularis WERMUTH 1965: 54"
51
- parse(val).should_not be_nil
52
- value(val).should == "Gymnodactylus irregularis WERMUTH 1965"
53
- details(val).should == {:genus=>"Gymnodactylus", :species=>"irregularis", :authors=>{:names=>["WERMUTH"], :year=>"1965"}, :name_part_verbatim=>"Gymnodactylus irregularis", :auth_part_verbatim=>"WERMUTH 1965: 54"}
60
+ sn = "Gymnodactylus irregularis WERMUTH 1965: 54"
61
+ parse(sn).should_not be_nil
62
+ value(sn).should == "Gymnodactylus irregularis WERMUTH 1965"
63
+ details(sn).should == {:genus=>"Gymnodactylus", :species=>"irregularis", :authors=>{:names=>["WERMUTH"], :year=>"1965"}, :name_part_verbatim=>"Gymnodactylus irregularis", :auth_part_verbatim=>"WERMUTH 1965: 54"}
64
+ pos(sn).should == {0=>["genus", 13], 14=>["species", 25], 26=>["author_word", 33], 34=>["year", 38]}
54
65
  end
55
66
 
56
67
  it 'should parse double parenthesis' do
57
- val = "Meiostemon humbertii ( (H. Perrier) ) Exell & Stace"
58
- parse(val).should_not be_nil
59
- value(val).should == "Meiostemon humbertii (H. Perrier) Exell et Stace"
60
- details(val).should == {:genus=>"Meiostemon", :species=>"humbertii", :orig_authors=>{:names=>["H. Perrier"]}, :authors=>{:names=>["Exell", "Stace"]}, :name_part_verbatim=>"Meiostemon humbertii", :auth_part_verbatim=>"( (H. Perrier) ) Exell & Stace"}
68
+ sn = "Meiostemon humbertii ( (H. Perrier) ) Exell & Stace"
69
+ parse(sn).should_not be_nil
70
+ value(sn).should == "Meiostemon humbertii (H. Perrier) Exell et Stace"
71
+ details(sn).should == {:genus=>"Meiostemon", :species=>"humbertii", :orig_authors=>{:names=>["H. Perrier"]}, :authors=>{:names=>["Exell", "Stace"]}, :name_part_verbatim=>"Meiostemon humbertii", :auth_part_verbatim=>"( (H. Perrier) ) Exell & Stace"}
72
+ pos(sn).should == {0=>["genus", 10], 11=>["species", 20], 24=>["author_word", 26], 27=>["author_word", 34], 38=>["author_word", 43], 46=>["author_word", 51]}
61
73
  end
62
74
 
63
75
  # Acomys "Geoffroy, I." 1838
@@ -80,11 +92,15 @@ describe ScientificNameDirty do
80
92
  parse("Tridentella tangeroae Bruce, 1988B").should_not be_nil
81
93
  parse("Tridentella tangeroae Bruce, 1988b").should_not be_nil
82
94
  parse("Tridentella tangeroae Bruce, 1988d").should_not be_nil
83
- parse("Tridentella tangeroae Bruce, 198?").should_not be_nil
95
+ sn = "Tridentella tangeroae Bruce, 198?"
96
+ parse(sn).should_not be_nil
97
+ pos(sn).should == {0=>["genus", 11], 12=>["species", 21], 22=>["author_word", 27], 29=>["year", 33]}
84
98
  end
85
99
 
86
100
  it 'should parse double years' do
87
- parse("Tridentella tangeroae Bruce, 1987-92").should_not be_nil
101
+ sn = "Tridentella tangeroae Bruce, 1987-92"
102
+ parse(sn).should_not be_nil
103
+ pos(sn).should == {0=>["genus", 11], 12=>["species", 21], 22=>["author_word", 27], 29=>["year", 36]}
88
104
  end
89
105
 
90
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dimus-biodiversity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin