Test edge cases and unusual inputs.
(self)
| 207 | assert classify_sql_statement(complex_dql) == "DQL" |
| 208 | |
| 209 | def test_edge_cases(self): |
| 210 | """Test edge cases and unusual inputs.""" |
| 211 | # Empty string |
| 212 | assert classify_sql_statement("") == "unknown" |
| 213 | |
| 214 | # Whitespace only |
| 215 | assert classify_sql_statement(" ") == "unknown" |
| 216 | |
| 217 | # Invalid SQL |
| 218 | assert classify_sql_statement("INVALID SQL STATEMENT") == "unknown" |
| 219 | assert ( |
| 220 | classify_sql_statement("SELECT * FROM") == "unknown" |
| 221 | ) # Incomplete statement |
| 222 | |
| 223 | # SQL with comments |
| 224 | assert ( |
| 225 | classify_sql_statement("-- This is a comment\nSELECT * FROM users") |
| 226 | == "DQL" |
| 227 | ) |
| 228 | assert ( |
| 229 | classify_sql_statement( |
| 230 | "/* Multi-line comment */\nCREATE TABLE users (id INT)" |
| 231 | ) |
| 232 | == "DDL" |
| 233 | ) |
| 234 | |
| 235 | def test_multiple_statements(self): |
| 236 | """Test that the function handles the first statement in a batch.""" |
nothing calls this directly
no test coverage detected