Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
ce3208c7
Unverified
Commit
ce3208c7
authored
1 year ago
by
Siraj R Aizlewood
Browse files
Options
Downloads
Patches
Plain Diff
Linting.
parent
fcda0ea0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/test_layer.py
+15
-5
15 additions, 5 deletions
tests/unit/test_layer.py
with
15 additions
and
5 deletions
tests/unit/test_layer.py
+
15
−
5
View file @
ce3208c7
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment