mattdeitke
commited on
Commit
·
495fbae
1
Parent(s):
b9e7719
new tests
Browse files- tests/test_api.py +45 -0
tests/test_api.py
CHANGED
@@ -5,6 +5,9 @@ import fsspec
|
|
5 |
import pandas as pd
|
6 |
|
7 |
from objaverse_xl.github import GitHubDownloader
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
def test_github_process_repo():
|
@@ -494,3 +497,45 @@ def test_github_download_cache():
|
|
494 |
save_repo_format=save_repo_format, # type: ignore
|
495 |
)
|
496 |
assert len(out) == 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import pandas as pd
|
6 |
|
7 |
from objaverse_xl.github import GitHubDownloader
|
8 |
+
from objaverse_xl.objaverse_v1 import SketchfabDownloader
|
9 |
+
from objaverse_xl.thingiverse import ThingiverseDownloader
|
10 |
+
from objaverse_xl.smithsonian import SmithsonianDownloader
|
11 |
|
12 |
|
13 |
def test_github_process_repo():
|
|
|
497 |
save_repo_format=save_repo_format, # type: ignore
|
498 |
)
|
499 |
assert len(out) == 0
|
500 |
+
|
501 |
+
|
502 |
+
def test_annotations():
|
503 |
+
downloaders = [
|
504 |
+
GitHubDownloader(),
|
505 |
+
SketchfabDownloader(),
|
506 |
+
SmithsonianDownloader(),
|
507 |
+
ThingiverseDownloader(),
|
508 |
+
]
|
509 |
+
|
510 |
+
for downloader in downloaders:
|
511 |
+
annotations_df = downloader.get_annotations()
|
512 |
+
|
513 |
+
# make sure the columns are
|
514 |
+
assert set(annotations_df.columns) == set(
|
515 |
+
["fileIdentifier", "source", "license", "fileType", "sha256", "metadata"]
|
516 |
+
)
|
517 |
+
|
518 |
+
|
519 |
+
def test_download_objects():
|
520 |
+
downloaders = [
|
521 |
+
GitHubDownloader(),
|
522 |
+
SketchfabDownloader(),
|
523 |
+
SmithsonianDownloader(),
|
524 |
+
ThingiverseDownloader(),
|
525 |
+
]
|
526 |
+
|
527 |
+
download_dir = "~/.objaverse-tests"
|
528 |
+
|
529 |
+
for downloader in downloaders:
|
530 |
+
shutil.rmtree(os.path.expanduser(download_dir), ignore_errors=True)
|
531 |
+
|
532 |
+
annotations_df = downloader.get_annotations()
|
533 |
+
|
534 |
+
test_objects = annotations_df.head(n=2)
|
535 |
+
|
536 |
+
out = downloader.download_objects(
|
537 |
+
objects=test_objects,
|
538 |
+
download_dir=download_dir,
|
539 |
+
processes=2,
|
540 |
+
)
|
541 |
+
assert isinstance(out, dict), f"{out=}"
|