Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
    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,
            )
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
 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, []),
         )
Ejemplo n.º 8
0
 def test_non_route(self):
     assert_non_equivalent(
         Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES),
         None,
         )
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
 def test_non_sub_route_collection(self):
     route = Route(FAKE_VIEW, FAKE_ROUTE_NAME, FAKE_SUB_ROUTES)
     assert_non_equivalent(route.sub_routes, None)