causmos.tests package

Submodules

causmos.tests.test_causmos_model module

class causmos.tests.test_causmos_model.CausmosModelTest(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

assert_tql_resultset_generated(c)
create_causmos(set_opportunity=True, set_intervention=True, set_outcome=True, set_treatment=True)
create_intervention()
create_opportunity()
create_outcome()
create_treatment()
class datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

Bases: datetime.date

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

astimezone()

tz -> convert to local time in new timezone tz

combine()

date, time -> datetime with same date and time fields

ctime()

Return ctime() style string.

date()

Return date object with same year, month and day.

dst()

Return self.tzinfo.dst(self).

fold
fromtimestamp()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

hour
isoformat()

[sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM]. sep is used to separate the year from the time, and defaults to ‘T’. timespec specifies what components of the time to include (allowed values are ‘auto’, ‘hours’, ‘minutes’, ‘seconds’, ‘milliseconds’, and ‘microseconds’).

max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
microsecond
min = datetime.datetime(1, 1, 1, 0, 0)
minute
now()

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.

replace()

Return datetime with new specified fields.

resolution = datetime.timedelta(0, 0, 1)
second
strptime()

string, format -> new datetime parsed from a string (like time.strptime()).

time()

Return time object with same time but with tzinfo=None.

timestamp()

Return POSIX timestamp as float.

timetuple()

Return time tuple, compatible with time.localtime().

timetz()

Return time object with same time and tzinfo.

tzinfo
tzname()

Return self.tzinfo.tzname(self).

utcfromtimestamp()

Construct a naive UTC datetime from a POSIX timestamp.

utcnow()

Return a new datetime representing UTC day and time.

utcoffset()

Return self.tzinfo.utcoffset(self).

utctimetuple()

Return UTC time tuple, compatible with time.localtime().

failing_test_analysis_method_treated_where_filter()
setUp() None

Hook method for setting up the test fixture before exercising it.

set_activity(activity_type='purchase', offset_sec: int = 0, user_id: str = 'u1', start=1609459200000)
set_bid(ghosted: bool = False, won: Optional[bool] = None, bid_amount=1, offset_sec: int = 0, user_id: str = 'u1', start=1609459200000)
set_events(bid_events=None, activity_events=None, user_id: str = 'u1')
tearDown() None

Hook method for deconstructing the test fixture after testing it.

test_ab()
test_ab_shape()
test_abtot_shape()
test_analysis_method_treated_with_attribute()
test_analysis_method_treated_without_attributes()
test_causmos_options()
test_configure_observables()
test_diff_in_diff()
test_diff_in_diff_cont()
test_diff_in_diff_panel()
test_outcome_not_preceded_by_intervention()
test_outcome_preceded_by_intervention()
test_pre_post()
test_prepost_shape()
test_sum_opp_ab_BKD_attributes()
test_sum_opp_ab_KD()
test_treated()
test_treated_on_treated()
test_treated_shape()
test_uplift()
test_uplift_requires_opportunity()

causmos.tests.test_causmos_quickstart module

class causmos.tests.test_causmos_quickstart.TestCausmosQuickstart(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_causmos_demo()

causmos.tests.test_causmos_sampling module

causmos.tests.test_event_group module

causmos.tests.test_validation module

class causmos.tests.test_validation.ValidationTest(methodName='runTest')

Bases: unittest.case.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_validate_attributes()
test_validate_dedup()