def test_validate_valid_binomen(self): """Returns true if botanical_name contains a valid binomen.""" assert BotanicalName.validate('Asclepias incarnata') assert BotanicalName.validate('Helianthus anuus') assert BotanicalName.validate('Hydrangea Lacecap Group')
def test_validate_starts_with_lower(self): """The first letter of a botanical name should be uppercase.""" assert not BotanicalName.validate('asclepias incarnata')
def test_validate_not_a_string(self): """Return False when given non-string data.""" assert not BotanicalName.validate(42) assert not BotanicalName.validate(('foo', 'bar')) assert not BotanicalName.validate(dict(foo='bar'))
def test_validate_upper_in_wrong_place(self): """The only uppercase letter in the first word should be the first.""" assert not BotanicalName.validate('AscLepias incarnata')
def test_validate_more_than_two_words(self): """A botanical name is still valid with more than 2 words.""" assert BotanicalName.validate('Brassica oleracea Var.')