<jupyter_start><jupyter_text>Test notebook lazy pipeline<jupyter_code># Installed packages
import pandas as pd

# Testing
from IPython.utils.capture import capture_output

# Our package
from pandas_profiling import ProfileReport
from pandas_profiling.utils.cache import cache_file
# Read the Titanic Dataset
file_name = cache_file(
    "titanic.csv",
    "https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",
)
df = pd.read_csv(file_name)
# Generate the Profiling Report (with progress bar)
with capture_output() as out:
    profile = ProfileReport(df, title="Titanic Dataset", progress_bar=True, lazy=False)

assert all(
    any(v in s.data["text/plain"] for v in ["%|", "FloatProgress"]) for s in out.outputs
)
assert len(out.outputs) == 2
# Generate the Profiling Report (without progress bar)
with capture_output() as out:
    profile = df.profile_report(
        title="Titanic Dataset",
        html={"style": {"full_width": True}},
        progress_bar=True,
        lazy=True,
    )

assert len(out.outputs) == 0

with capture_output() as out:
    _ = profile.to_html()


assert all(
    any(v in s.data["text/plain"] for v in ["%|", "FloatProgress"]) for s in out.outputs
)
assert len(out.outputs) == 3

with capture_output() as out:
    _ = profile.to_file("/tmp/tmpfile.html")

assert "Export report to file" in out.outputs[0].data["text/plain"]
assert len(out.outputs) == 1
# Test caching of the iterative building process
with capture_output() as out:
    profile = ProfileReport(df, title="Titanic Dataset", progress_bar=True, lazy=True)
assert len(out.outputs) == 0

with capture_output() as out:
    profile.description_set
assert len(out.outputs) == 1

with capture_output() as out:
    profile.report
assert len(out.outputs) == 1

with capture_output() as out:
    profile.html
assert len(out.outputs) == 1

with capture_output() as out:
    profile.config.html.style.theme = "united"
    profile.invalidate_cache("rendering")
    profile.to_file("/tmp/cache1.html")
assert len(out.outputs) == 2

with capture_output() as out:
    profile.config.pool_size = 1
    profile.html
assert len(out.outputs) == 0

with capture_output() as out:
    profile.config.pool_size = 0
    profile.config.samples.head = 5
    profile.config.samples.tail = 15
    profile.invalidate_cache()
    profile.to_file("/tmp/cache2.html")
assert len(out.outputs) == 4<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12246586677699628, 'fraction_numerical': 0.007860984691766652, 'mean_word_length': 4.349557522123894, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '359902', 'license': 'MIT', 'n_tokens_mistral': 807, 'n_tokens_neox': 779, 'n_words': 207, 'path': 'tests/notebooks/lazy_pipeline.ipynb', 'repo_name': 'Anselmoo/pandas-profiling', 'size': '2417'}