-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
859ecb3
commit 3ffbc13
Showing
6 changed files
with
148 additions
and
31 deletions.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
__pycache__/ | ||
donotinclude/ |
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
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ beautifulsoup4 | |
loguru | ||
requests | ||
scrape-schema-recipe>=0.1.3 | ||
pendulum | ||
PyYAML |
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,36 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import unittest | ||
import recipe_crawler | ||
|
||
## Test for the URLTest class | ||
class TestURLTest(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.urltest = recipe_crawler.URLTest("https://www.example.com/") | ||
|
||
def test_is_absolute_url_true(self): | ||
assert self.urltest.is_absolute_url("http://www.example.com/") | ||
assert self.urltest.is_absolute_url("https://www.example.com/") | ||
|
||
def test_is_absolute_url_false(self): | ||
assert self.urltest.is_absolute_url("#") is False | ||
assert self.urltest.is_absolute_url("javascript:on_click()") is False | ||
assert self.urltest.is_absolute_url("/relative_url") is False | ||
|
||
def test_is_same_domain_true(self): | ||
assert self.urltest.is_same_domain("https://www.example.com/tacos/") | ||
# fixed in version 0.0.2 | ||
assert self.urltest.is_same_domain("https://WWW.EXAMPLE.COM/") | ||
|
||
def test_is_same_domain_false(self): | ||
assert ( | ||
self.urltest.is_same_domain("https://www.somedifferentdomain.com/") is False | ||
) | ||
assert ( | ||
self.urltest.is_same_domain("https://www.somedifferentdomain.com/tacos/") | ||
is False | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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