Skip to content

Commit

Permalink
Calculated proper numbers for number of controls/joints for tests.
Browse files Browse the repository at this point in the history
Added a traceback to try to alleviate the TestBuildHand suite's failing...
  • Loading branch information
AndresMWeber committed Mar 22, 2018
1 parent e0e0bce commit caeded7
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions tests/acceptance/test_hand.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import traceback
import string
import anvil.config as cfg
import anvil.node_types as nt
from anvil.utils.scene import print_scene_tree
from anvil.sub_rig_templates import Hand
from tests.base_test import TestBase, clean_up_scene, auto_save_result
import string
import anvil.config as cfg
from pprint import pprint


class TestHandBase(TestBase):
Expand All @@ -16,6 +16,8 @@ class TestHandBase(TestBase):
@classmethod
def from_template_file(cls, template_file, finger_start_joints=None, **kwargs):
cls.import_template_files(template_file)
print('Successfully imported template file %s' % template_file)
print_scene_tree()

kwargs['layout_joints'] = []
for finger in finger_start_joints:
Expand All @@ -32,28 +34,24 @@ def setUpClass(cls):
super(TestBuildHand, cls).setUpClass()
try:
cls.hand = cls.from_template_file(cls.HAND_MERC, cls.HAND_MERC_JOINTS)
except (IndexError, KeyError) as e:
except Exception:
print_scene_tree()
raise e
traceback.print_exc()
raise

def test_number_of_controls_from_flat_hierarchy(self):
pprint(self.hand.hierarchy)
self.assertEqual(len([node for node in self.hand._flat_hierarchy() if isinstance(node, nt.Control)]), 15)
self.assertEqual(len([node for node in self.hand._flat_hierarchy() if isinstance(node, nt.Control)]), 25)

def test_number_of_controls_from_get_children(self):
pprint(self.hand.hierarchy)
self.assertEqual(len(self.hand.group_controls.get_children()), 10)
def test_number_of_joints_from_flat_hierarchy(self):
self.assertEqual(len([node for node in self.hand._flat_hierarchy() if isinstance(node, nt.Joint)]), 60)

def test_number_of_joint_chains_from_get_children(self):
pprint(self.hand.hierarchy)
def test_number_of_joint_top_groups_from_get_children(self):
self.assertEqual(len(self.hand.group_joints.get_children()), 15)

def test_number_of_joints_from_flat_hierarchy(self):
pprint(self.hand.hierarchy)
self.assertEqual(len([node for node in self.hand._flat_hierarchy() if isinstance(node, nt.Joint)]), 15)
def test_number_of_control_top_groups_from_get_children(self):
self.assertEqual(len(self.hand.group_controls.get_children()), 10)

def test_number_of_nodes_from_get_children(self):
pprint(self.hand.hierarchy)
self.assertEqual(len(self.hand.group_nodes.get_children()), 5)


Expand All @@ -73,7 +71,11 @@ def test_build_no_kwargs_no_errors(self):
@clean_up_scene
@auto_save_result
def test_build_with_rp_solver(self):
self.assertIsNotNone(self.from_template_file(self.HAND_MERC, self.HAND_MERC_JOINTS, solver=cfg.IK_RP_SOLVER))
rig = self.from_template_file(self.HAND_MERC, self.HAND_MERC_JOINTS, solver=cfg.IK_RP_SOLVER)
from pprint import pprint
pprint(rig._flat_hierarchy())
pprint(rig.hierarchy)
self.assertEqual(len([node for node in rig._flat_hierarchy() if isinstance(node, nt.Control)]), 30)


class TestGetFingerBaseNames(TestHandBase):
Expand Down

0 comments on commit caeded7

Please sign in to comment.