You can use unittest.mock
# builtins
from unittest.mock import patch
# 3rd party
import pandas as pd
with patch("boto3.resources.factory.s3.ObjectSummary") as patched_obj:
patched_obj.return_value = pd.DataFrame()
# run test in this scope
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…