Skip to content

Instantly share code, notes, and snippets.

@initcron
Created November 29, 2024 07:22
Show Gist options
  • Save initcron/1c9c1073d8463a2e260ab4e43f9d4c13 to your computer and use it in GitHub Desktop.
Save initcron/1c9c1073d8463a2e260ab4e43f9d4c13 to your computer and use it in GitHub Desktop.
import pytest
import Mixed_Language_Demo as databrics_code # Import the module
def test_dataframe_creation():
"""
Test for the `create_dataframe` function
"""
# Create the DataFrame
df = databrics_code.create_dataframe()
# Verify the DataFrame structure
assert df is not None
assert len(df) == 3 # Three rows
assert "Name" in df.columns
assert list(df["Name"]) == ["Amar", "Akbar", "Anthony"]
def test_dataframe_summary():
"""
Test the `print_dataframe_summary` function
"""
# Create the DataFrame
df = databrics_code.create_dataframe()
# Ensure no exceptions are raised during summary printing
try:
databrics_code.print_dataframe_summary(df)
except Exception as e:
pytest.fail(f"Summary printing failed with error: {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment