Skip to content

Commit

Permalink
upgrade mf2py to 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Jul 18, 2018
1 parent 1b4627e commit a989c3e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
5 changes: 3 additions & 2 deletions granary/test/test_atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ def test_html_to_atom(self):
<title>my content
x
y
z</title>
z
</title>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
Expand Down Expand Up @@ -638,7 +639,7 @@ def test_html_to_atom_title_without_hfeed_name(self):
self.assert_multiline_in("""\
<generator uri="https://granary.io/">granary</generator>
<id>https://my.site/feed</id>
<title>unmarked feed title</title>
<title>User feed for Unknown</title>
""", atom.html_to_atom("""\
<div class="h-feed">
<span>unmarked feed title</span>
Expand Down
25 changes: 23 additions & 2 deletions granary/test/test_microformats2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding=utf-8
"""Unit tests for source.py.
"""Unit tests for microformats2.py.
Most of the tests are in testdata/. This is just a few things that are too small
for full testdata tests.
Expand Down Expand Up @@ -689,7 +689,7 @@ def test_json_to_object_simple_name_author(self):
def test_json_to_object_authorship_fetch_mf2_func(self):
self.expect_requests_get('http://example.com', u"""
<div class="h-card">
<a class="p-name u-url" rel="me" href="/">Ms. ☕ Baz</span>
<a class="p-name u-url" rel="me" href="/">Ms. ☕ Baz</a>
<img class="u-photo" src="/my/pic" />
</div>
""")
Expand Down Expand Up @@ -819,3 +819,24 @@ def test_combined_reply_and_tag_of_error(self):
'in-reply-to': [{'value': 'https://another/post'}],
}
})


def test_html_to_activities_brs_to_newlines(self):
"""Mostly tests that mf2py converts <br>s to \ns.
Background:
https://github.com/snarfed/granary/issues/142
https://github.com/microformats/mf2py/issues/51
https://pin13.net/mf2/whitespace.html
"""
html = """\
<article class="h-entry">
<div class="e-content p-name">foo bar<br />baz <br><br> baj</div>
</article>"""
activities = microformats2.html_to_activities(html)
self.assert_equals([{'object': {
'objectType': 'note',
'content': 'foo bar<br/>baz <br/><br/> baj',
'content_is_html': True,
'displayName': 'foo bar\nbaz \n\n baj',
}}], activities)
2 changes: 1 addition & 1 deletion requirements.freeze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ humanize==0.5.1
idna==2.6
Jinja2==2.10
MarkupSafe==1.0
mf2py==1.0.5
mf2py==1.1.1
-e git+https://github.com/snarfed/mf2util.git@992b2655be66a128bb40f847f3eba0ed955cadfe#egg=mf2util
mox3==0.24.0
mox==0.5.3
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ brevity>=0.2.17
future
html2text
jinja2
mf2py>=0.2.7
mf2py>=1.1.1
mf2util>=0.5.0
mox3>=0.24.0
oauth-dropins>=1.12
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, *args, **kwargs):
'future',
'html2text',
'jinja2',
'mf2py>=0.2.7',
'mf2py>=1.1.1',
'mf2util>=0.5.0',
'oauth-dropins>=1.12',
'requests-toolbelt>=0.6.2',
Expand Down
2 changes: 1 addition & 1 deletion test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
xml:base="http://my/">
<generator uri="https://granary.io/">granary</generator>
<id>http://my/posts.html</id>
<title>my title</title>
<title>User feed for My Name</title>
<logo>http://my/picture</logo>
<updated>2012-03-04T18:20:37+00:00</updated>
Expand Down

0 comments on commit a989c3e

Please sign in to comment.