Beispiel #1
0
 def test_pre_filter(self, example_freq, default_kwargs):
     """Test if function calls pre_filter correctly."""
     default_kwargs["agg_level"] = "user"
     default_kwargs["thresh_sp_at_loc"] = 2
     li = location_identifier(example_freq,
                              method="FREQ",
                              pre_filter=True,
                              **default_kwargs)
     f = pre_filter_locations(example_freq, **default_kwargs)
     example_freq.loc[f, "activity_label"] = freq_method(
         example_freq[f])["activity_label"]
     assert_geodataframe_equal(li, example_freq)
Beispiel #2
0
 def test_freq_method(self, example_freq):
     """Test if function calls freq method correctly."""
     li = location_identifier(example_freq, method="FREQ", pre_filter=False)
     fr = freq_method(example_freq)
     assert_geodataframe_equal(li, fr)
Beispiel #3
0
 def test_unkown_method(self, example_staypoints):
     """Test if ValueError is risen if method is unknown"""
     with pytest.raises(ValueError):
         location_identifier(example_staypoints,
                             method="UNKNOWN",
                             pre_filter=False)
Beispiel #4
0
 def test_no_location_column(self, example_staypoints):
     """Test if key error is risen if no column `location_id`."""
     with pytest.raises(KeyError):
         del example_staypoints["location_id"]
         location_identifier(example_staypoints)
 def test_osna_method(self, example_osna):
     """Test if function calls osna method correctly."""
     li = location_identifier(example_osna, method="OSNA", pre_filter=False)
     osna = osna_method(example_osna)
     assert_geodataframe_equal(li, osna)