Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronikobrosly committed May 18, 2020
1 parent 1de6a0c commit c6780dd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 21 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Change Log
==========

Version 0.1.3
-------------
- Simplifying unit and integration tests.


Version 0.1.2
-------------

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Roni Kobrosly'

# The full version, including alpha/beta/rc tags
release = '0.1.2'
release = '0.1.3'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="causal-curve",
version="0.1.2",
version="0.1.3",
author="Roni Kobrosly",
author_email="[email protected]",
description="A python library with tools to perform causal inference using \
Expand Down
14 changes: 8 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@

@pytest.fixture(scope="module")
def dataset_fixture():
"""Returns full_example_dataset"""
return full_example_dataset()


def full_example_dataset():
"""Example dataset with a treatment, two covariates, and outcome variable"""

np.random.seed(500)

n = 500
n_obs = 500

treatment = np.random.normal(loc=50.0, scale=10.0, size=n)
x1 = np.random.normal(loc=50.0, scale=10.0, size=n)
x2 = np.random.normal(loc=0, scale=10.0, size=n)
outcome = treatment + x1 + x2 + np.random.normal(loc=50.0, scale=3.0, size=n)
treatment = np.random.normal(loc=50.0, scale=10.0, size=n_obs)
x_1 = np.random.normal(loc=50.0, scale=10.0, size=n_obs)
x_2 = np.random.normal(loc=0, scale=10.0, size=n_obs)
outcome = treatment + x_1 + x_2 + np.random.normal(loc=50.0, scale=3.0, size=n_obs)

fixture = pd.DataFrame(
{"treatment": treatment, "x1": x1, "x2": x2, "outcome": outcome}
{"treatment": treatment, "x1": x_1, "x2": x_2, "outcome": outcome}
)

fixture.reset_index(drop=True, inplace=True)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pandas as pd

from causal_curve import GPS
from tests.test_helpers import assert_df_equal


def test_full_gps_flow(dataset_fixture):
Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_tmle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pandas as pd

from causal_curve import TMLE
from tests.test_helpers import assert_df_equal


def test_full_tmle_flow(dataset_fixture):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Misc helper functions for tests"""


import pandas as pd
from pandas.testing import assert_frame_equal


Expand Down
5 changes: 1 addition & 4 deletions tests/unit/test_gps.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
""" Unit tests of the gps.py module """


import pandas as pd
from pygam import LinearGAM

from causal_curve import GPS
from tests.test_helpers import assert_df_equal


def test_GPS_fit(dataset_fixture):
def test_gps_fit(dataset_fixture):
"""
Tests the fit method GPS tool
"""
Expand Down
6 changes: 1 addition & 5 deletions tests/unit/test_tmle.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
""" Unit tests of the tmle.py module """


import pandas as pd

from causal_curve import TMLE
from tests.test_helpers import assert_df_equal


def test_TMLE_fit(dataset_fixture):
def test_tmle_fit(dataset_fixture):
"""
Tests the fit method GPS tool
"""
Expand Down

0 comments on commit c6780dd

Please sign in to comment.