def test_unmoving_counts_column_names(get_column_names_from_run):
    assert get_column_names_from_run(
        RedactedUnmovingCounts(unmoving_counts=UnmovingCounts(
            Unmoving(locations=UniqueLocations(
                SubscriberLocations(
                    "2016-01-01",
                    "2016-01-01 10:00",
                    spatial_unit=make_spatial_unit("admin", level=3),
                )))))) == ["pcod", "value"]
예제 #2
0
    def _flowmachine_query_obj(self):
        """
        Return the underlying flowmachine object.

        Returns
        -------
        Query
        """
        return RedactedUnmovingCounts(unmoving_counts=UnmovingCounts(
            Unmoving(self.locations._flowmachine_query_obj)))
예제 #3
0
def test_unmoving_counts_values(get_dataframe):
    df = get_dataframe(
        UnmovingCounts(
            Unmoving(locations=UniqueLocations(
                SubscriberLocations(
                    "2016-01-01",
                    "2016-01-01 10:00",
                    spatial_unit=make_spatial_unit("admin", level=3),
                ))))).set_index("pcod")
    assert df.loc["524 1 02 09"].value == 5
    assert df.loc["524 2 04 20"].value == 7
def test_unmoving_counts_values(get_dataframe):
    df = get_dataframe(
        RedactedUnmovingCounts(unmoving_counts=UnmovingCounts(
            Unmoving(locations=UniqueLocations(
                SubscriberLocations(
                    "2016-01-01",
                    "2016-01-01 10:00",
                    spatial_unit=make_spatial_unit("admin", level=2),
                )))))).set_index("pcod")
    with pytest.raises(KeyError):
        assert df.loc["524 1 02"].value
    assert df.loc["524 4 12"].value == 29