Created
March 3, 2022 15:04
-
-
Save Eligijus112/8d6f897eef24a6291be217fa373a6340 to your computer and use it in GitHub Desktop.
A unit test example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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