kopia lustrzana https://gitlab.com/jaywink/federation
rodzic
cddebf87cd
commit
fde1e988da
|
@ -3,6 +3,9 @@
|
|||
### Changed
|
||||
- Test factories and other test files are now included in the package installation. Factories can be useful when creating project tests.
|
||||
|
||||
### Fixes
|
||||
- Don't raise on Post.tags if Post.raw_content is None
|
||||
|
||||
## [0.3.1] - 2016-04-13
|
||||
|
||||
### Added
|
||||
|
|
|
@ -83,6 +83,8 @@ class RawContentMixin(BaseEntity):
|
|||
@property
|
||||
def tags(self):
|
||||
"""Returns a `set` of unique tags contained in `raw_content`."""
|
||||
if not self.raw_content:
|
||||
return set()
|
||||
return set({word.strip("#") for word in self.raw_content.split() if word.startswith("#")})
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ class TestPostEntityTags(object):
|
|||
post = TaggedPostFactory()
|
||||
assert post.tags == {"tagone", "tagtwo", "tagthree"}
|
||||
|
||||
def test_post_entity_without_raw_content_tags_returns_empty_set(self):
|
||||
post = PostFactory(raw_content=None)
|
||||
assert post.tags == set()
|
||||
|
||||
|
||||
class TestBaseEntityCallsValidateMethods(object):
|
||||
def test_entity_calls_attribute_validate_method(self):
|
||||
|
|
Ładowanie…
Reference in New Issue