Skip to content

Commit

Permalink
2 more test to go!
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinTaterra committed Jul 26, 2024
1 parent 6646faf commit 9b33fc9
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion mdpath/tests/test_mdpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import mdpath
from multiprocessing import Pool
import mdpath.src
import mdpath.src.bootstrap
import mdpath.src.notebook_vis
import mdpath.src.structure
import mdpath.src.graph
Expand All @@ -27,6 +28,7 @@
import os
import json
import nglview as nv
import mdpath.src.bootstrap

import mdpath.src.visualization

Expand Down Expand Up @@ -941,4 +943,26 @@ def normalize_js(js_code):
f"Expected JavaScript code for cluster 2 not found in actual calls.\n"
f"Expected: {normalized_expected_cluster2}\n"
f"Actual: {normalized_actual_calls}"
)
)

def test_create_bootstrap_sample():
"""Test the create_bootstrap_sample function."""
df = pd.DataFrame({
'A': [1, 2, 3],
'B': [4, 5, 6]
})

result = mdpath.src.bootstrap.create_bootstrap_sample(df)

assert isinstance(result, pd.DataFrame), "Result should be a Pandas DataFrame"

assert result.shape == df.shape, "Bootstrap sample should have the same shape as the input DataFrame"
assert len(result) == len(df), "Number of rows in bootstrap sample should be the same as the input DataFrame"

assert set(result.columns) == set(df.columns), "Columns of bootstrap sample should match input DataFrame columns"

for col in df.columns:
original_values = set(df[col])
sampled_values = set(result[col])
assert sampled_values.issubset(original_values), f"Column {col} in bootstrap sample contains values not in the input DataFrame"

0 comments on commit 9b33fc9

Please sign in to comment.