Skip to content

Commit 5cb6057

Browse files
Updated
1 parent 67c5f1c commit 5cb6057

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

pandas/tests/mocking/test_database_io.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ def test_read_sql_basic(self, monkeypatch):
1616
1717
Test Oracle (FR-5): Reading a SQL query that returns 100 rows and 3 columns
1818
should create a DataFrame with 100 rows and 3 columns
19-
20-
Rationale: Database connections are external dependencies; mocking allows
21-
testing SQL functionality without a real database server
19+
2220
"""
2321
# Setup: Mock data that would come from database
2422
expected_data = pd.DataFrame({
@@ -44,9 +42,7 @@ def mock_read_sql(query, con, **kwargs):
4442
def test_read_sql_empty_result(self, monkeypatch):
4543
"""
4644
Test SQL query returning empty result set
47-
48-
Rationale: Empty query results are common; pandas should handle
49-
them gracefully with an empty DataFrame
45+
5046
"""
5147
# Setup: Mock empty result
5248
empty_data = pd.DataFrame(columns=['id', 'name', 'value'])
@@ -67,9 +63,6 @@ def mock_read_sql(query, con, **kwargs):
6763
def test_read_sql_with_parameters(self, monkeypatch):
6864
"""
6965
Test parameterized SQL queries
70-
71-
Rationale: Parameterized queries prevent SQL injection; verify pandas
72-
handles parameter passing correctly
7366
"""
7467
# Setup: Mock filtered data
7568
filtered_data = pd.DataFrame({
@@ -103,7 +96,6 @@ def test_read_sql_dtype_handling(self, monkeypatch):
10396
Test Oracle (FR-5): SQL INTEGER should convert to int64, VARCHAR to string,
10497
DECIMAL to float64 in the resulting DataFrame
10598
106-
Rationale: Type mapping from SQL to pandas is critical for correctness
10799
"""
108100
# Setup: Mock with specific dtypes (using dict to avoid dtype conversion)
109101
typed_data = pd.DataFrame({
@@ -132,9 +124,7 @@ def mock_read_sql(query, con, **kwargs):
132124
def test_read_sql_connection_error_handling(self, monkeypatch):
133125
"""
134126
Test error handling when database connection fails
135-
136-
Rationale: Connection failures are common in production; pandas should
137-
handle them with clear error messages
127+
138128
"""
139129
# Setup: Mock to raise connection error
140130
def mock_read_sql(query, con, **kwargs):

pandas/tests/mocking/test_filesystem_io.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"""
22
Unit Testing II - Mocking & Stubbing: File System I/O Operations
33
Sandeep
4-
Requirement: Loading data from flat files (CSV, Excel, HDF5)
5-
6-
74
"""
85

96
import pytest

0 commit comments

Comments
 (0)