Skip to content

Commit

Permalink
Fixing the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresMWeber committed Feb 16, 2018
1 parent 3081fac commit 3617f0c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions tests/acceptance/test_biped_foot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,24 @@ class TestBaseTemplateRigs(TestBase):
test_rig = None
TEMPLATE_CLASS = BipedFoot


class TestBuildBipedFoot(TestBaseTemplateRigs):

@classmethod
def from_template_file(cls, template_file, pre_build_hook=None, post_build_hook=None, **kwargs):
def from_template_file(cls, template_file, pre_build_hook=None, post_build_hook=None,
**kwargs):
default_return_func = lambda: {}
pre_build_hook = pre_build_hook or default_return_func
post_build_hook = post_build_hook or default_return_func

cls.import_template_files(template_file)

kwargs.update(pre_build_hook())

rig_instance = cls.TEMPLATE_CLASS(layout_joints=map(nt.Transform, ['foot', 'ball', 'toe']),
heel=nt.Transform('heel'),
outsole='outsole',
insole='insole')
rig_instance = cls.TEMPLATE_CLASS(layout_joints=map(nt.Transform, ['foot', 'ball', 'toe']), heel='heel')
rig_instance.build(**kwargs)

post_build_hook()

return rig_instance


class TestBuildBipedFoot(TestBaseTemplateRigs):

def test_build_no_kwargs(self):
with cleanup_nodes():
self.from_template_file(self.FOOT)
Expand All @@ -45,10 +40,15 @@ def test_build_with_parent(self):

def test_build_with_leg_ik_and_soles(self):
with cleanup_nodes():
rig_instance = self.from_template_file(self.FOOT_WITH_LEG_AND_SOLES, insole='insole', outsole='outsole',
pre_build_hook=self.build_leg_ik)

#self.assertEqual([round(p, 5) for p in control.offset_group.get_world_position()],
self.import_template_files(self.FOOT_WITH_LEG_AND_SOLES)
self.build_leg_ik()
rig_instance = self.TEMPLATE_CLASS(layout_joints=map(nt.Transform, ['foot', 'ball', 'toe']),
heel='heel',
insole='insole',
outsole='outsole')
rig_instance.build()

# self.assertEqual([round(p, 5) for p in control.offset_group.get_world_position()],
# [round(p, 5) for p in joint.get_world_position()])

def test_build_with_leg_ik(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dag_node.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import anvil.node_types as nt
import anvil
from base_test import TestBase

from anvil.errors import APIError

class TestBaseDagNode(TestBase):
pass
Expand Down Expand Up @@ -32,7 +32,7 @@ def rename_runner(self, desired_output, input_name):
self.assertEqual(str(dag_node), desired_output)

def test_empty_input(self):
self.assertRaises(RuntimeError, self.rename_runner, None, '')
self.assertRaises(APIError, self.rename_runner, None, '')

def test_single_char_input(self):
self.rename_runner('n', 'n')
Expand Down

0 comments on commit 3617f0c

Please sign in to comment.