Skip to content
Snippets Groups Projects
Unverified Commit ce3208c7 authored by Siraj R Aizlewood's avatar Siraj R Aizlewood
Browse files

Linting.

parent fcda0ea0
Branches
Tags
No related merge requests found
......@@ -170,7 +170,9 @@ class TestRouteLayer:
def test_list_route_names(self, openai_encoder, routes):
route_layer = RouteLayer(encoder=openai_encoder, routes=routes)
route_names = route_layer.list_route_names()
assert set(route_names) == {route.name for route in routes}, "The list of route names should match the names of the routes added."
assert set(route_names) == {
route.name for route in routes
}, "The list of route names should match the names of the routes added."
def test_remove_route(self, openai_encoder, routes):
route_layer = RouteLayer(encoder=openai_encoder, routes=routes)
......@@ -178,12 +180,18 @@ class TestRouteLayer:
route_to_remove = routes[0].name
route_layer.remove(route_to_remove)
# Ensure the route is no longer in the route layer
assert route_to_remove not in route_layer.list_route_names(), "The route should be removed from the route layer."
assert (
route_to_remove not in route_layer.list_route_names()
), "The route should be removed from the route layer."
# Ensure the route is no longer in the index or categories
assert route_to_remove not in route_layer.categories, "The route should be removed from the categories."
assert (
route_to_remove not in route_layer.categories
), "The route should be removed from the categories."
# Ensure the route's utterances are no longer in the index
for utterance in routes[0].utterances:
assert utterance not in route_layer.index, "The route's utterances should be removed from the index."
assert (
utterance not in route_layer.index
), "The route's utterances should be removed from the index."
def test_remove_route_not_found(self, openai_encoder, routes):
route_layer = RouteLayer(encoder=openai_encoder, routes=routes)
......@@ -191,7 +199,9 @@ class TestRouteLayer:
non_existent_route = "non-existent-route"
with pytest.raises(ValueError) as excinfo:
route_layer.remove(non_existent_route)
assert str(excinfo.value) == f"Route `{non_existent_route}` not found", "Attempting to remove a non-existent route should raise a ValueError."
assert (
str(excinfo.value) == f"Route `{non_existent_route}` not found"
), "Attempting to remove a non-existent route should raise a ValueError."
def test_add_multiple_routes(self, openai_encoder, routes):
route_layer = RouteLayer(encoder=openai_encoder)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment