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

Filter only multitable placeholder 172658719 #196

Merged
merged 17 commits into from
May 11, 2020

Conversation

scanny
Copy link
Contributor

@scanny scanny commented May 4, 2020

Add _Strand.cube_index and _Strand.title for to enable handling of filter-only multitable-template placeholders.

@coveralls
Copy link

coveralls commented May 4, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 5aa58b3 on filter-only-multitable-placeholder-172658719 into 5979508 on master.

):
self._cube_response_arg = response
self._transforms_dict = {} if transforms is None else transforms
self._first_cube_of_tab = first_cube_of_tab
self._cube_idx_arg = cube_idx
Copy link
Contributor

@ernestoarbitrio ernestoarbitrio May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why self._cube_idx_arg and not self._cube_idx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cube_idx_arg (the cube_idx argument) can be None or int. Cube index is always an int. So the _arg suffix cues the reader to look for some reason why the argument doesn't directly become the served value.

@@ -233,6 +231,11 @@ def counts(self):
def counts_with_missings(self):
return self._measure(self.is_weighted).raw_cube_array

@lazyproperty
def cube_index(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity: does this property returns a cube idx or an offset?

Copy link
Contributor Author

@scanny scanny May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idx and "offset" are generally synonymous. In this case, it is always a positive int value, the first cube returning 0, the next 1, etc. It is never None however. We use None on the cube_idx_arg to indicate that the cube appears by itself, that is, that the cube count is 1. That informs the ._is_multi_cube property and ca-as-0th detection, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -392,6 +400,10 @@ def but_it_raises_on_other_cube_response_types(self, cube_response, expected_val

# fixture components ---------------------------------------------

@pytest.fixture
def _cube_dict_prop_(self, request):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this fixture component mandatory considering that it's used only in it_knows_its_title test? IMHO I would mock that property in the test directly

Copy link
Contributor Author

@scanny scanny May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at the moment, but that's because the unit test coverage is still very spotty on this class. I made the judgement to include it since that property is used in like four other methods so will be needed when those unit tests are added.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

scanny added 17 commits May 11, 2020 12:44
Convention dictates all test classes for a module reside in the same
corresponding test module.
Avoid using unshared parameterized fixtures distant from the test that
uses it when possible (when cases take less than a dozen lines or so).

Use `@pytest.mark.parametrize` to provide case data instead in those
cases.
These maybe used to work in the old slice implementation but `row_index` and custom-baseline have not been needed in the new implementation.
Tighten identification of numeric-mean case to avoid false positives as
we introduce filter-only multitable-template placeholders.
Unit-test coverage is spotty. Fill this one in because we need to adjust
the method slightly in a subsequent commit.
Exports need to know the cube-index to inform certain rules like
identifying filter-only multitable tiles.

Replace `first_cube_of_tab` argument and instance variable with
`cube_idx`, which provides more information.
Also a couple incidental fixes for small gaps uncovered along the way.
@scanny scanny force-pushed the filter-only-multitable-placeholder-172658719 branch from 5aa58b3 to 44d0cd8 Compare May 11, 2020 20:15
@scanny scanny merged commit a8463f6 into master May 11, 2020
@scanny scanny deleted the filter-only-multitable-placeholder-172658719 branch May 20, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants