Skip to content

Commit

Permalink
Merge e160da4 into ffc5514
Browse files Browse the repository at this point in the history
  • Loading branch information
slobodan-ilic committed Mar 4, 2019
2 parents ffc5514 + e160da4 commit 801dc5d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cr/cube/cube_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def can_compare_pairwise(self):
if self.ndim != 2:
return False

return all(dt in (DT.CAT, DT.CA_CAT) for dt in self.dim_types)
return all(dt in DT.ALLOWED_PAIRWISE_TYPES for dt in self.dim_types)

@lazyproperty
def dim_types(self):
Expand Down
3 changes: 3 additions & 0 deletions src/cr/cube/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ class DIMENSION_TYPE(object):

# ---subsets---
ARRAY_TYPES = frozenset((CA_SUBVAR, MR_SUBVAR))

# ---allowed types for pairwise comparison---
ALLOWED_PAIRWISE_TYPES = frozenset((CAT, CA_CAT, BINNED_NUMERIC, DATETIME, TEXT))
9 changes: 6 additions & 3 deletions tests/unit/test_cube_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,16 @@ def it_can_compare_pairwise(
((DT.CA_SUBVAR, DT.CA_CAT), False),
((DT.CA_SUBVAR, DT.MR, DT.CA_CAT), False),
((DT.MR, DT.CAT), False),
((DT.BINNED_NUMERIC, DT.CAT), False),
((DT.DATETIME, DT.CAT), False),
((DT.LOGICAL, DT.CAT), False),
((DT.TEXT, DT.CAT), False),
((DT.CA_CAT, DT.CAT), True),
((DT.CAT, DT.CA_CAT), True),
((DT.CAT, DT.CAT), True),
((DT.BINNED_NUMERIC, DT.CAT), True),
((DT.CAT, DT.BINNED_NUMERIC), True),
((DT.DATETIME, DT.CAT), True),
((DT.CAT, DT.DATETIME), True),
((DT.CAT, DT.TEXT), True),
((DT.TEXT, DT.CAT), True),
]
)
def pairwise_comparisons_fixture(self, request):
Expand Down

0 comments on commit 801dc5d

Please sign in to comment.