def params_for_test_no_stuck(): param_names = ['cls', 'tilemap', 'start_rect', 'dx', 'dy', 'expect_dxdy'] scenaries = [ d for d in aux.case_generator(aux.first_expansion(maps_cache, aux.common_base_cases))] sufixes_parametrized_tests = [] cases = [] for cls in [RectMapCollider, RectMapWithPropsCollider]: for d in scenaries: d['cls'] = cls test_sufix, params = scenario_to_test_sufix_and_tuple_params(d) sufixes_parametrized_tests.append(test_sufix) cases.append(params) return (param_names, cases, False, sufixes_parametrized_tests)
## assert a == b ## ## def test_zerodivision(self, a, b): ## py.test.raises(ZeroDivisionError, "a/b") ## ##class TestClass2(): ## params = { ## "test_concatenation": [dict(r='a', s='b', res='ab'), ## dict(r='aa', s='bb', res='aabb')] ## } ## ## def test_concatenation(self, r, s, res): ## assert r+s+'z' == res scenario = [ d for d in aux.case_generator( aux.first_expansion(maps_cache, aux.common_base_cases)) ] class TestClass(): params = { 'test_RectMapCollider__no_stuck': scenario, 'test_RectMapWithPropsCollider__no_stuck': scenario, } def test_RectMapCollider__no_stuck(self, generic_id, tilemap, start_rect, dx, dy, expect_dxdy): collider = RectMapCollider() collider.on_bump_handler = collider.on_bump_slide new = start_rect.copy() new.x += dx
## def test_equals(self, a, b): ## assert a == b ## ## def test_zerodivision(self, a, b): ## py.test.raises(ZeroDivisionError, "a/b") ## ##class TestClass2(): ## params = { ## "test_concatenation": [dict(r='a', s='b', res='ab'), ## dict(r='aa', s='bb', res='aabb')] ## } ## ## def test_concatenation(self, r, s, res): ## assert r+s+'z' == res scenario = [ d for d in aux.case_generator(aux.first_expansion(maps_cache, aux.common_base_cases))] class TestClass(): params = { 'test_RectMapCollider__no_stuck': scenario, 'test_RectMapWithPropsCollider__no_stuck': scenario, } def test_RectMapCollider__no_stuck(self, generic_id, tilemap, start_rect, dx, dy, expect_dxdy): collider = RectMapCollider() collider.on_bump_handler = collider.on_bump_slide new = start_rect.copy() new.x += dx new.y += dy collider.collide_map(tilemap, start_rect, new, 0, 0) assert new.position == (start_rect.x + expect_dxdy[0],