basic advanced example

This commit is contained in:
Vysyr committed 2026-10-31 23:11:57 +01:00
1 parent 6fe57915e8
commit bd8edf5afb
29 files changed
+1501 -38

No files matched your search

+7
View File
@@ -19,6 +19,9 @@ class Clip:
def get_name(self):
return "EmbeddedTake"
def get_play_length(self):
return 1.5
class DiscoveryTests(unittest.TestCase):
def setUp(self):
@@ -40,6 +43,7 @@ class DiscoveryTests(unittest.TestCase):
self.cache = patch.object(self.module, "_cached", return_value=[Mesh()]).start()
self.importer = patch.object(self.module, "_import", return_value=[Mesh()]).start()
self.animation = patch.object(self.module, "import_animation", side_effect=lambda *a, **kw: Clip()).start()
self.catalog = patch.object(self.module, "update_catalog").start()
self.addCleanup(patch.stopall)
def test_discovery_excludes_model_and_derives_names_without_aliases(self):
@@ -55,6 +59,8 @@ class DiscoveryTests(unittest.TestCase):
self.assertEqual(self.animation.call_count, 2)
for call in self.animation.call_args_list:
self.assertFalse(call.kwargs["reimport"])
self.catalog.assert_called_once_with("Hero", {
"great_sword_attack_2": 1.5, "great_sword_walk": 1.5}, replace=True)
def test_empty_dictionary_disables_discovery_and_keeps_embedded_name(self):
self.cache.return_value = [Mesh(), Clip()]
@@ -67,6 +73,7 @@ class DiscoveryTests(unittest.TestCase):
self.assertEqual(set(result.animations), {"selected"})
self.animation.assert_called_once()
self.assertEqual(self.animation.call_args.args[0], self.walk)
self.catalog.assert_called_once_with("Hero", {"selected": 1.5}, replace=False)
def test_reimport_true_reimports_model_and_discovered_clips(self):
self.module.import_model(self.model, name="Hero", reimport=True)