@@ -22,7 +22,7 @@ def test_interface_error():
2222 """Test InterfaceError with message."""
2323 message = "Database interface error occurred"
2424 error = InterfaceError (message )
25-
25+
2626 assert isinstance (error , Error )
2727 assert error .message == message
2828
@@ -31,7 +31,7 @@ def test_interface_error_string_representation():
3131 """Test InterfaceError has message attribute."""
3232 message = "Connection failed"
3333 error = InterfaceError (message )
34-
34+
3535 assert hasattr (error , 'message' )
3636 assert error .message == message
3737
@@ -41,9 +41,9 @@ def test_database_error_with_empty_response():
4141 mock_response = Mock ()
4242 mock_response .text = ""
4343 mock_response .status_code = 500
44-
44+
4545 error = DatabaseError (mock_response )
46-
46+
4747 assert "Unknown Error" in error .message
4848 assert error .status_code == 500
4949
@@ -58,9 +58,9 @@ def test_database_error_with_json_api_message():
5858 "details" : "Additional context"
5959 }
6060 mock_response .status_code = 400
61-
61+
6262 error = DatabaseError (mock_response )
63-
63+
6464 assert "Database operation failed" in error .message
6565 assert error .status_code == 400
6666 assert error .error_obj == mock_response .json ()
@@ -77,9 +77,9 @@ def test_database_error_with_vio_message():
7777 }
7878 }
7979 mock_response .status_code = 422
80-
80+
8181 error = DatabaseError (mock_response )
82-
82+
8383 assert "Validation failed" in error .message
8484 assert error .status_code == 422
8585
@@ -93,9 +93,9 @@ def test_database_error_with_unknown_json():
9393 "unknown_field" : "some value"
9494 }
9595 mock_response .status_code = 500
96-
96+
9797 error = DatabaseError (mock_response )
98-
98+
9999 assert "Unknown Error" in error .message
100100 assert error .status_code == 500
101101
@@ -106,9 +106,9 @@ def test_database_error_with_non_json_response():
106106 mock_response .text = "Plain text error message"
107107 mock_response .headers = {"content-type" : "text/plain" }
108108 mock_response .status_code = 503
109-
109+
110110 error = DatabaseError (mock_response )
111-
111+
112112 assert error .message == "Plain text error message"
113113 assert error .error_obj is None
114114 assert error .status_code == 503
@@ -120,9 +120,9 @@ def test_database_error_string_representation():
120120 mock_response .text = "Error message"
121121 mock_response .headers = {"content-type" : "text/plain" }
122122 mock_response .status_code = 500
123-
123+
124124 error = DatabaseError (mock_response )
125-
125+
126126 assert str (error ) == error .message
127127
128128
@@ -132,9 +132,9 @@ def test_operational_error():
132132 mock_response .text = "Operational error"
133133 mock_response .headers = {"content-type" : "text/plain" }
134134 mock_response .status_code = 500
135-
135+
136136 error = OperationalError (mock_response )
137-
137+
138138 assert isinstance (error , DatabaseError )
139139 assert isinstance (error , Error )
140140 assert error .message == "Operational error"
@@ -146,9 +146,9 @@ def test_access_denied_error():
146146 mock_response .text = "Access denied"
147147 mock_response .headers = {"content-type" : "text/plain" }
148148 mock_response .status_code = 403
149-
149+
150150 error = AccessDeniedError (mock_response )
151-
151+
152152 assert isinstance (error , DatabaseError )
153153 assert isinstance (error , Error )
154154 assert error .message == "Access denied"
@@ -166,7 +166,7 @@ def test_api_error_class_exists():
166166def test_invalid_uri_error ():
167167 """Test InvalidURIError can be instantiated."""
168168 error = InvalidURIError ()
169-
169+
170170 assert isinstance (error , Error )
171171 assert isinstance (error , Exception )
172172
@@ -175,7 +175,7 @@ def test_invalid_uri_error_is_simple_error():
175175 """Test InvalidURIError is a simple pass-through error."""
176176 # InvalidURIError is a simple pass class, no custom __init__
177177 error = InvalidURIError ()
178-
178+
179179 assert isinstance (error , Error )
180180 assert isinstance (error , Exception )
181181
@@ -191,9 +191,9 @@ def test_database_error_json_formatting():
191191 }
192192 mock_response .json .return_value = error_data
193193 mock_response .status_code = 400
194-
194+
195195 error = DatabaseError (mock_response )
196-
196+
197197 # Check that formatted JSON is in the message
198198 formatted = json .dumps (error_data , indent = 4 , sort_keys = True )
199199 assert formatted in error .message
@@ -206,7 +206,7 @@ def test_all_error_classes_are_exceptions():
206206 InterfaceError ("test" ),
207207 InvalidURIError ()
208208 ]
209-
209+
210210 for error in errors :
211211 assert isinstance (error , Exception )
212212
@@ -217,18 +217,18 @@ def test_error_inheritance_chain():
217217 mock_response .text = "test"
218218 mock_response .headers = {"content-type" : "text/plain" }
219219 mock_response .status_code = 500
220-
220+
221221 operational = OperationalError (mock_response )
222222 access_denied = AccessDeniedError (mock_response )
223-
223+
224224 # All should be DatabaseError
225225 assert isinstance (operational , DatabaseError )
226226 assert isinstance (access_denied , DatabaseError )
227-
227+
228228 # All should be Error
229229 assert isinstance (operational , Error )
230230 assert isinstance (access_denied , Error )
231-
231+
232232 # All should be Exception
233233 assert isinstance (operational , Exception )
234234 assert isinstance (access_denied , Exception )
0 commit comments