Esempio n. 1
0
def test_unmoving_at_reference_location_counts_column_names(
        get_column_names_from_run):
    assert (get_column_names_from_run(
        UnmovingAtReferenceLocationCounts(
            UnmovingAtReferenceLocation(
                locations=UniqueLocations(
                    SubscriberLocations(
                        "2016-01-01",
                        "2016-01-01 10:00",
                        spatial_unit=make_spatial_unit("admin", level=3),
                    )),
                reference_locations=LastLocation("2016-01-01", "2016-01-02"),
            ))) == ["pcod", "value"])
Esempio n. 2
0
    def _flowmachine_query_obj(self):
        """
        Return the underlying flowmachine object.

        Returns
        -------
        Query
        """
        return RedactedUnmovingAtReferenceLocationCounts(
            unmoving_at_reference_location_counts=
            UnmovingAtReferenceLocationCounts(
                UnmovingAtReferenceLocation(
                    locations=self.locations._flowmachine_query_obj,
                    reference_locations=self.reference_locations.
                    _flowmachine_query_obj,
                )))
Esempio n. 3
0
def test_unmoving_at_reference_location_counts_values(get_dataframe):
    df = get_dataframe(
        UnmovingAtReferenceLocationCounts(
            UnmovingAtReferenceLocation(
                locations=UniqueLocations(
                    SubscriberLocations(
                        "2016-01-01",
                        "2016-01-01 10:00",
                        spatial_unit=make_spatial_unit("admin", level=1),
                    )),
                reference_locations=LastLocation(
                    "2016-01-01",
                    "2016-01-02",
                    spatial_unit=make_spatial_unit("admin", level=1),
                ),
            ))).set_index("pcod")
    assert df.loc["524 1"].value == 2
    assert df.loc["524 4"].value == 26