summaryrefslogtreecommitdiffstats
path: root/python/tests/import_file_generic.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 18:13:14 -0700
commitcdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7 (patch)
tree5e4034027b51f3ee4d2a488bb2cbb7a75c3bd0d8 /python/tests/import_file_generic.py
parent78f08280edea4ff65ca613ad30005c45cc48dea6 (diff)
downloadfatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.tar.gz
fatcat-cdfd6b85b386b7bbf9d5a5179ef26970b6e5a4e7.zip
fmt (black): tests/
Diffstat (limited to 'python/tests/import_file_generic.py')
-rw-r--r--python/tests/import_file_generic.py98
1 files changed, 68 insertions, 30 deletions
diff --git a/python/tests/import_file_generic.py b/python/tests/import_file_generic.py
index e1d987e8..9eeeb2bb 100644
--- a/python/tests/import_file_generic.py
+++ b/python/tests/import_file_generic.py
@@ -1,4 +1,3 @@
-
import pytest
from fatcat_openapi_client import *
@@ -23,77 +22,116 @@ def test_file_update_generic():
url_sets = [
# dummy
{
- 'before': [],
- 'after': [],
+ "before": [],
+ "after": [],
},
# social => academicsocial
{
- 'before': [
+ "before": [
FileUrl(url="https://academic.edu/blah.pdf", rel="social"),
],
- 'after': [
+ "after": [
FileUrl(url="https://academic.edu/blah.pdf", rel="academicsocial"),
],
},
# archive.org repository => archive
{
- 'before': [
+ "before": [
FileUrl(url="https://archive.org/download/item/blah.pdf", rel="repository"),
],
- 'after': [
+ "after": [
FileUrl(url="https://archive.org/download/item/blah.pdf", rel="archive"),
],
},
# :80 in URL is redundant
{
- 'before': [
- FileUrl(url="http://homepages.math.uic.edu/~rosendal/PapersWebsite/BanachMinimalExamples.pdf", rel="web"),
- FileUrl(url="http://homepages.math.uic.edu:80/~rosendal/PapersWebsite/BanachMinimalExamples.pdf", rel="web"),
+ "before": [
+ FileUrl(
+ url="http://homepages.math.uic.edu/~rosendal/PapersWebsite/BanachMinimalExamples.pdf",
+ rel="web",
+ ),
+ FileUrl(
+ url="http://homepages.math.uic.edu:80/~rosendal/PapersWebsite/BanachMinimalExamples.pdf",
+ rel="web",
+ ),
FileUrl(url="http://mit.edu/item/blah.pdf", rel="web"),
FileUrl(url="http://mit.edu:80/item/blah.pdf", rel="web"),
],
- 'after': [
- FileUrl(url="http://homepages.math.uic.edu/~rosendal/PapersWebsite/BanachMinimalExamples.pdf", rel="web"),
+ "after": [
+ FileUrl(
+ url="http://homepages.math.uic.edu/~rosendal/PapersWebsite/BanachMinimalExamples.pdf",
+ rel="web",
+ ),
FileUrl(url="http://mit.edu/item/blah.pdf", rel="web"),
],
},
{
- 'before': [
+ "before": [
FileUrl(url="http://mit.edu:80/item/blah.pdf", rel="web"),
],
- 'after': [
+ "after": [
FileUrl(url="http://mit.edu:80/item/blah.pdf", rel="web"),
],
},
# http/https redundant
{
- 'before': [
- FileUrl(url="https://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf", rel="web"),
- FileUrl(url="http://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf", rel="web"),
+ "before": [
+ FileUrl(
+ url="https://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf",
+ rel="web",
+ ),
+ FileUrl(
+ url="http://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf",
+ rel="web",
+ ),
FileUrl(url="https://mit.edu/item/blah.pdf", rel="web"),
- FileUrl(url="https://web.archive.org/web/12345542/http://mit.edu/item/blah.pdf", rel="webarchive"),
+ FileUrl(
+ url="https://web.archive.org/web/12345542/http://mit.edu/item/blah.pdf",
+ rel="webarchive",
+ ),
FileUrl(url="http://mit.edu/item/blah.pdf", rel="web"),
- FileUrl(url="https://web.archive.org/web/12345542/something.com/blah.pdf", rel="webarchive"),
+ FileUrl(
+ url="https://web.archive.org/web/12345542/something.com/blah.pdf",
+ rel="webarchive",
+ ),
],
- 'after': [
- FileUrl(url="https://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf", rel="web"),
+ "after": [
+ FileUrl(
+ url="https://eo1.gsfc.nasa.gov/new/validationReport/Technology/JoeCD/asner_etal_PNAS_20041.pdf",
+ rel="web",
+ ),
FileUrl(url="https://mit.edu/item/blah.pdf", rel="web"),
- FileUrl(url="https://web.archive.org/web/12345542/http://mit.edu/item/blah.pdf", rel="webarchive"),
- FileUrl(url="https://web.archive.org/web/12345542/something.com/blah.pdf", rel="webarchive"),
+ FileUrl(
+ url="https://web.archive.org/web/12345542/http://mit.edu/item/blah.pdf",
+ rel="webarchive",
+ ),
+ FileUrl(
+ url="https://web.archive.org/web/12345542/something.com/blah.pdf",
+ rel="webarchive",
+ ),
],
},
# short /2017/ wayback datetime
{
- 'before': [
- FileUrl(url="https://web.archive.org/web/2017/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38", rel="webarchive"),
- FileUrl(url="https://web.archive.org/web/20170922010835/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38", rel="webarchive"),
+ "before": [
+ FileUrl(
+ url="https://web.archive.org/web/2017/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38",
+ rel="webarchive",
+ ),
+ FileUrl(
+ url="https://web.archive.org/web/20170922010835/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38",
+ rel="webarchive",
+ ),
],
- 'after': [
- FileUrl(url="https://web.archive.org/web/20170922010835/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38", rel="webarchive"),
+ "after": [
+ FileUrl(
+ url="https://web.archive.org/web/20170922010835/http://www.geoamazonia.net/index.php/revista/article/download/51/pdf_38",
+ rel="webarchive",
+ ),
],
},
]
for pair in url_sets:
- f1.urls = pair['before']
- assert EntityImporter.generic_file_cleanups(f1).urls == pair['after']
+ f1.urls = pair["before"]
+ assert EntityImporter.generic_file_cleanups(f1).urls == pair["after"]