Skip to content

Instantly share code, notes, and snippets.

@Eligijus112
Created March 3, 2022 15:04
Show Gist options
  • Save Eligijus112/8d6f897eef24a6291be217fa373a6340 to your computer and use it in GitHub Desktop.
Save Eligijus112/8d6f897eef24a6291be217fa373a6340 to your computer and use it in GitHub Desktop.
A unit test example
# Importing the function to test
from pipeline.modules.read_data import read_json
# Dir traversal
import os
def test_data_reading():
"""
Tests the data reading functionality of the pipeline
"""
# Arrange
_path_to_data = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'data',
'stub_data.json'
)
# Act
d = read_json(_path_to_data)
# Assert
assert d.shape == (3, 2)
assert set(d.columns) == set(['reviewText', 'overall'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment