Sort newest Hub models and run image encoder on second GPU
This commit is contained in:
@@ -12,6 +12,14 @@ class CatalogTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):safe_url(value)
|
||||
for value in ['../foo','a/b/c','https://x','a/..']:
|
||||
with self.assertRaises(ValueError):repo_id(value)
|
||||
def test_newest_search_is_sorted_upstream_and_returns_creation_date(self):
|
||||
from urllib.parse import urlsplit,parse_qs
|
||||
with tempfile.TemporaryDirectory() as d,patch('catalog.metadata',return_value=[{'id':'owner/new','createdAt':'2026-09-28T00:00:00Z'}]) as fetch:
|
||||
result=Catalog(d).search('qwen','image','newest')
|
||||
query=parse_qs(urlsplit(fetch.call_args.args[0]).query)
|
||||
self.assertEqual(query['sort'],['createdAt']);self.assertEqual(query['direction'],['-1'])
|
||||
self.assertEqual(result['models'][0]['created_at'],'2026-09-28T00:00:00Z')
|
||||
with self.assertRaises(ValueError):Catalog(d).search('','image','invalid')
|
||||
def test_download_integrity_and_library(self):
|
||||
for valid in (True,False):
|
||||
with self.subTest(valid=valid),tempfile.TemporaryDirectory() as directory:
|
||||
|
||||
Reference in New Issue
Block a user