Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of fixtures in agg primitive tests #325

Merged
merged 3 commits into from Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -42,38 +42,6 @@ def es():
return make_ecommerce_entityset()


@pytest.fixture
def child_entity(es):
return es['customers']


@pytest.fixture
def grandchild_entity(es):
return es['sessions']


@pytest.fixture
def child(es, child_entity):
return Count(es['sessions']['id'],
parent_entity=child_entity)


@pytest.fixture
def parent_class():
return Mean


@pytest.fixture
def parent_entity(es):
return es[u'régions']


@pytest.fixture
def parent(parent_class, parent_entity, child):
return make_parent_instance(parent_class,
parent_entity, child)


@pytest.fixture
def test_primitive():
class TestAgg(AggregationPrimitive):
Expand All @@ -88,11 +56,6 @@ def get_function(self):
return TestAgg


def make_parent_instance(parent_class, parent_entity, base_feature,
where=None):
return parent_class(base_feature, parent_entity, where=where)


def test_get_depth(es):
log_id_feat = es['log']['id']
customer_id_feat = es['customers']['id']
Expand Down Expand Up @@ -153,16 +116,18 @@ def count_generate_name(self):
assert (values == feature_matrix[count_null.get_name()]).all()


def test_check_input_types(es, child, parent):
mean = parent
def test_check_input_types(es):
count = Count(es["sessions"]["id"], es["customers"])
mean = Mean(count, es[u"régions"])
assert mean._check_input_types()
boolean = child > 3
mean = make_parent_instance(Mean, es[u'régions'],
child, where=boolean)

boolean = count > 3
mean = Mean(count, es[u"régions"], where=boolean)
assert mean._check_input_types()


def test_base_of_and_stack_on_heuristic(es, test_primitive, child):
def test_base_of_and_stack_on_heuristic(es, test_primitive):
child = Count(es["sessions"]["id"], es["customers"])
test_primitive.stack_on = []
child.base_of = []
assert not (check_stacking(test_primitive, [child]))
Expand Down Expand Up @@ -200,9 +165,9 @@ def test_base_of_and_stack_on_heuristic(es, test_primitive, child):
assert (check_stacking(test_primitive, [child]))


def test_stack_on_self(es, test_primitive, parent_entity):
def test_stack_on_self(es, test_primitive):
# test stacks on self
child = test_primitive(es['log']['value'], parent_entity)
child = test_primitive(es['log']['value'], es[u'régions'])
test_primitive.stack_on = []
child.base_of = []
test_primitive.stack_on_self = False
Expand All @@ -217,9 +182,9 @@ def test_stack_on_self(es, test_primitive, parent_entity):
assert not (check_stacking(test_primitive, [child]))


def test_stack_expanding(es, test_primitive, parent_entity):
def test_stack_expanding(es, test_primitive):
test_primitive.input_types = [Discrete]
expanding_primitive = NMostCommon(es['sessions']['device_type'], parent_entity)
expanding_primitive = NMostCommon(es['sessions']['device_type'], es[u'régions'])
assert not (check_stacking(test_primitive, [expanding_primitive]))


Expand Down