This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Do not raise an exception when previewing empty media. #8883
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a 500 error when attempting to preview an empty HTML file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ def test_long_summarize(self): | |
|
||
desc = summarize_paragraphs(example_paras, min_size=200, max_size=500) | ||
|
||
self.assertEquals( | ||
self.assertEqual( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
desc, | ||
"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:" | ||
" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in" | ||
|
@@ -69,7 +69,7 @@ def test_long_summarize(self): | |
|
||
desc = summarize_paragraphs(example_paras[1:], min_size=200, max_size=500) | ||
|
||
self.assertEquals( | ||
self.assertEqual( | ||
desc, | ||
"Tromsø lies in Northern Norway. The municipality has a population of" | ||
" (2015) 72,066, but with an annual influx of students it has over 75,000" | ||
|
@@ -96,7 +96,7 @@ def test_short_summarize(self): | |
|
||
desc = summarize_paragraphs(example_paras, min_size=200, max_size=500) | ||
|
||
self.assertEquals( | ||
self.assertEqual( | ||
desc, | ||
"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:" | ||
" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in" | ||
|
@@ -122,7 +122,7 @@ def test_small_then_large_summarize(self): | |
] | ||
|
||
desc = summarize_paragraphs(example_paras, min_size=200, max_size=500) | ||
self.assertEquals( | ||
self.assertEqual( | ||
desc, | ||
"Tromsø (Norwegian pronunciation: [ˈtrʊmsœ] ( listen); Northern Sami:" | ||
" Romsa; Finnish: Tromssa[2] Kven: Tromssa) is a city and municipality in" | ||
|
@@ -149,7 +149,7 @@ def test_simple(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
|
||
def test_comment(self): | ||
html = """ | ||
|
@@ -164,7 +164,7 @@ def test_comment(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
|
||
def test_comment2(self): | ||
html = """ | ||
|
@@ -182,7 +182,7 @@ def test_comment2(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals( | ||
self.assertEqual( | ||
og, | ||
{ | ||
"og:title": "Foo", | ||
|
@@ -203,7 +203,7 @@ def test_script(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": "Foo", "og:description": "Some text."}) | ||
|
||
def test_missing_title(self): | ||
html = """ | ||
|
@@ -216,7 +216,7 @@ def test_missing_title(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": None, "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": None, "og:description": "Some text."}) | ||
|
||
def test_h1_as_title(self): | ||
html = """ | ||
|
@@ -230,7 +230,7 @@ def test_h1_as_title(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": "Title", "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": "Title", "og:description": "Some text."}) | ||
|
||
def test_missing_title_and_broken_h1(self): | ||
html = """ | ||
|
@@ -244,4 +244,9 @@ def test_missing_title_and_broken_h1(self): | |
|
||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
|
||
self.assertEquals(og, {"og:title": None, "og:description": "Some text."}) | ||
self.assertEqual(og, {"og:title": None, "og:description": "Some text."}) | ||
|
||
def test_empty(self): | ||
html = "" | ||
og = decode_and_calc_og(html, "http://example.com/test.html") | ||
self.assertEqual(og, {}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative might be to check if
tree
(below) isNone
before passing it into_calc_og
.