def test_specialization_vs_non_specialization(self): generalized_route = Route(None, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES) specialized_route = generalized_route.create_specialization() route = Route(None, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES) assert_non_equivalent(specialized_route, route)
def test_sub_routes_with_different_attributes(self): sub_route_1 = Route(FAKE_VIEW, FAKE_ROUTE_NAME) route_1 = Route(None, None, [sub_route_1]) sub_route_2 = Route(FAKE_VIEW, None) route_2 = Route(None, None, [sub_route_2]) assert_non_equivalent(route_1.sub_routes, route_2.sub_routes)
def test_sub_route_collection_against_non_sub_route_collection(self): generalized_route = Route( FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES, ) specialized_route = generalized_route.create_specialization() assert_non_equivalent(specialized_route.sub_routes, None)
def test_sibling_specializations_with_different_attributes(self): generalized_route = Route( None, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES, ) specialized_route_1 = \ generalized_route.create_specialization(FAKE_VIEW) specialized_route_2 = generalized_route.create_specialization() assert_non_equivalent(specialized_route_1, specialized_route_2)
def test_sub_route_collection_against_different_sub_route_collection(self): generalized_route = Route( FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES, ) specialized_route_1 = generalized_route.create_specialization() specialized_route_2 = generalized_route.create_specialization( additional_sub_routes=[Route(None, None)], ) assert_non_equivalent( specialized_route_1.sub_routes, specialized_route_2.sub_routes, )
def test_sibling_specializations_with_different_sub_routes(self): generalized_sub_route = Route(None, None, FAKE_SUB_ROUTES) generalized_route = Route( FAKE_VIEW, FAKE_ROUTE_NAME, [generalized_sub_route], ) specialized_sub_route_1 = generalized_sub_route.create_specialization() specialized_route_1 = generalized_route.create_specialization( specialized_sub_routes=[specialized_sub_route_1], ) specialized_sub_route_2 = generalized_sub_route.create_specialization( view=object(), ) specialized_route_2 = generalized_route.create_specialization( specialized_sub_routes=[specialized_sub_route_2], ) assert_non_equivalent(specialized_route_1, specialized_route_2)
def test_routes_with_different_attributes(self): assert_non_equivalent( Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES), Route(object(), FAKE_ROUTE_NAME, FAKE_SUB_ROUTES), ) assert_non_equivalent( Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES), Route(FAKE_VIEW, 'another_name', FAKE_SUB_ROUTES), ) assert_non_equivalent( Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES), Route(FAKE_VIEW, FAKE_ROUTE_NAME, []), )
def test_non_route(self): assert_non_equivalent( Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES), None, )
def test_generalization_vs_specialization(self): generalized_route = Route(FAKE_VIEW, FAKE_ROUTE_NAME) specialized_route = generalized_route.create_specialization() assert_non_equivalent(generalized_route, specialized_route)
def test_non_sub_route_collection(self): route = Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES) assert_non_equivalent(route.sub_routes, None)