コード例 #1
0
    def it_provides_the_default_repr_when_enhanced_repr_fails(
            self, dimension_types_prop_):
        dimension_types_prop_.return_value = [1, 2, 3]
        cube = Cube(None)

        cube_repr = cube.__repr__()

        assert cube_repr.startswith("<cr.cube.cube.Cube object at 0x")
コード例 #2
0
    def it_provides_values_for_cat_x_cat(self):
        cube = Cube(CR.CAT_X_CAT)

        assert cube.__repr__(
        ) == "Cube(name='v4', dimension_types='CAT x CAT')"
        assert cube.counts == pytest.approx(np.array([[5, 2], [5, 3]]))
        assert cube.counts_with_missings == pytest.approx(
            np.array([[5, 3, 2, 0], [5, 2, 3, 0], [0, 0, 0, 0]]))
        assert cube.cube_index == 0
        assert cube.description == "Pet Owners"
        assert cube.dimension_types == (DT.CAT, DT.CAT)
        assert isinstance(cube.dimensions, _ApparentDimensions)
        assert cube.has_weighted_counts is False
        assert cube.missing == 5
        assert cube.name == "v4"
        assert cube.ndim == 2
        assert cube.population_fraction == 1.0
        assert cube.title == "Pony Owners"
        assert cube.unweighted_counts == pytest.approx(
            np.array([[5, 2], [5, 3]]))
        assert cube.weighted_counts is None