@@ -16,12 +16,12 @@ def test_db(client):
1616 """Create and cleanup a test database."""
1717 import time
1818 db_name = f"test_prefix_{ int (time .time () * 1000 )} "
19-
19+
2020 client .create_database (db_name , label = "Test Prefix DB" , description = "Database for testing prefix operations" )
2121 client .connect (db = db_name )
22-
22+
2323 yield db_name
24-
24+
2525 # Cleanup
2626 try :
2727 client .delete_database (db_name )
@@ -42,25 +42,25 @@ def test_add_prefix_success(self, client, test_db):
4242 def test_add_prefix_duplicate (self , client , test_db ):
4343 """Test that adding duplicate prefix fails."""
4444 client .add_prefix ("ex" , "http://example.org/" )
45-
45+
4646 with pytest .raises (Exception ) as exc_info :
4747 client .add_prefix ("ex" , "http://example.com/" )
48-
48+
4949 # Should get 400 error with PrefixAlreadyExists
5050 assert exc_info .value .response .status_code == 400
5151
5252 def test_add_prefix_invalid_iri (self , client , test_db ):
5353 """Test that invalid IRI is rejected."""
5454 with pytest .raises (Exception ) as exc_info :
5555 client .add_prefix ("ex" , "not-a-valid-uri" )
56-
56+
5757 assert exc_info .value .response .status_code == 400
5858
5959 def test_add_prefix_reserved (self , client , test_db ):
6060 """Test that reserved prefix names are rejected."""
6161 with pytest .raises (Exception ) as exc_info :
6262 client .add_prefix ("@custom" , "http://example.org/" )
63-
63+
6464 assert exc_info .value .response .status_code == 400
6565
6666 def test_get_prefix_success (self , client , test_db ):
@@ -73,17 +73,17 @@ def test_get_prefix_not_found(self, client, test_db):
7373 """Test that getting non-existent prefix fails."""
7474 with pytest .raises (Exception ) as exc_info :
7575 client .get_prefix ("nonexistent" )
76-
76+
7777 assert exc_info .value .response .status_code == 404
7878
7979 def test_update_prefix_success (self , client , test_db ):
8080 """Test updating an existing prefix."""
8181 client .add_prefix ("ex" , "http://example.org/" )
8282 result = client .update_prefix ("ex" , "http://example.com/" )
83-
83+
8484 assert result ["api:status" ] == "api:success"
8585 assert result ["api:prefix_uri" ] == "http://example.com/"
86-
86+
8787 # Verify the update
8888 uri = client .get_prefix ("ex" )
8989 assert uri == "http://example.com/"
@@ -92,7 +92,7 @@ def test_update_prefix_not_found(self, client, test_db):
9292 """Test that updating non-existent prefix fails."""
9393 with pytest .raises (Exception ) as exc_info :
9494 client .update_prefix ("nonexistent" , "http://example.org/" )
95-
95+
9696 assert exc_info .value .response .status_code == 404
9797
9898 def test_upsert_prefix_create (self , client , test_db ):
@@ -105,7 +105,7 @@ def test_upsert_prefix_update(self, client, test_db):
105105 """Test upsert updates prefix if it already exists."""
106106 client .add_prefix ("ex" , "http://example.org/" )
107107 result = client .upsert_prefix ("ex" , "http://example.com/" )
108-
108+
109109 assert result ["api:status" ] == "api:success"
110110 assert result ["api:prefix_uri" ] == "http://example.com/"
111111
@@ -114,7 +114,7 @@ def test_delete_prefix_success(self, client, test_db):
114114 client .add_prefix ("ex" , "http://example.org/" )
115115 result = client .delete_prefix ("ex" )
116116 assert result ["api:status" ] == "api:success"
117-
117+
118118 # Verify deletion
119119 with pytest .raises (Exception ) as exc_info :
120120 client .get_prefix ("ex" )
@@ -124,12 +124,12 @@ def test_delete_prefix_not_found(self, client, test_db):
124124 """Test that deleting non-existent prefix fails."""
125125 with pytest .raises (Exception ) as exc_info :
126126 client .delete_prefix ("nonexistent" )
127-
127+
128128 assert exc_info .value .response .status_code == 404
129129
130130 def test_delete_prefix_reserved (self , client , test_db ):
131131 """Test that deleting reserved prefix fails."""
132132 with pytest .raises (Exception ) as exc_info :
133133 client .delete_prefix ("@base" )
134-
134+
135135 assert exc_info .value .response .status_code == 400
0 commit comments