コード例 #1
0
 def test_closest_point_lenght_no_filter(self):
     params = {'filter': False, 'distance': 0}
     link_strategy = ClosestPoint(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     self.assertEqual(len(dataset.index), 3)
コード例 #2
0
 def test_empty_closest_point(self):
     params = {'filter': True, 'distance': 3}
     link_strategy = ClosestPoint(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     self.assertEqual(dataset.size, 0)
コード例 #3
0
 def test_polygon_lenght(self):
     params = {'distance': 3000}
     link_strategy = Polygon(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     self.assertEqual(len(dataset.index), 9)
コード例 #4
0
 def test_empty_polygon(self):
     params = {'distance': 3}
     link_strategy = Polygon(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     self.assertEqual(dataset.size, 0)
コード例 #5
0
 def test_closest_point(self):
     params = {'distance': 0, 'filter': False}
     link_strategy = ClosestPoint(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     linked_file = App.link_closest_points(self.gf1.get_id(), self.gf2.get_id(), "name", "description", params)
     dataset_linked = linked_file.get_data()
     pd.testing.assert_frame_equal(dataset, dataset_linked)
コード例 #6
0
 def test_polygon(self):
     params = {'distance': 3000}
     link_strategy = Polygon(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     linked_file = App.link_polygon(self.gf1.get_id(), self.gf2.get_id(), "name", "description", params)
     dataset_linked = linked_file.get_data()
     pd.testing.assert_frame_equal(dataset, dataset_linked)
コード例 #7
0
 def test_link_similarity_same_y_column(self):
     r_1 = Rule('verificado', 'JURISDICCI', [{"Verificado": "PROV"}])
     r_2 = Rule('valorVinchuca', 'JURISDICCI', [{"patagonica": "PROV"}])
     rules = [r_1, r_2]
     params = {'rules': rules}
     link_strategy = Similarity(params)
     ds_a = App.get_ds(self.gf1.get_id())
     ds_b = App.get_ds(self.gf2.get_id())
     dataset = link_strategy.link(ds_a, ds_b)
     self.assertTrue(len(dataset.index) == 1)
コード例 #8
0
 def test_categorize_uncategorize_values(self):
     dataset = App.get_ds(self.gf2.get_id()).get_data()
     cat_col = Categorizer.categorize_column(dataset, 'p1')
     dataset['p1_cat'] = cat_col
     cat_value = dataset.iloc[0]['p1_cat']
     real_value = dataset.iloc[0]['p1']
     uncat_value = Categorizer.uncategorize_value(dataset, 'p1', cat_value)
     self.assertEqual(real_value, uncat_value)
コード例 #9
0
 def test_get_details(self):
     ds_a = App.get_ds(self.gf.get_id())
     details = ds_a.get_details()
     self.assertEqual(details['name'], 'geofile test')
     self.assertEqual(details['description'], 'description')
     self.assertEqual(details['doc'], 'test_files/GeoVin_sample.csv')
コード例 #10
0
 def test_categorize_column_long(self):
     dataset = App.get_ds(self.gf2.get_id()).get_data()
     cat_col = Categorizer.categorize_column(dataset, 'p1')
     uncat_col = dataset[['p1']]
     self.assertEqual(len(cat_col), len(uncat_col))