def test_Linearity(self): self.df_streets["lin"] = mm.Linearity(self.df_streets).series euclidean = Point(self.df_streets.geometry[0].coords[0]).distance( Point(self.df_streets.geometry[0].coords[-1]) ) check = euclidean / self.df_streets.geometry[0].length assert self.df_streets["lin"][0] == check
def test_Linearity(self): self.df_streets["lin"] = mm.Linearity(self.df_streets).series euclidean = Point(self.df_streets.geometry[0].coords[0]).distance( Point(self.df_streets.geometry[0].coords[-1]) ) check = euclidean / self.df_streets.geometry[0].length assert self.df_streets["lin"][0] == approx(check, rel=1e-6) self.df_streets.loc[len(self.df_streets)] = MultiLineString( [[(0, 0), (-1, 1)], [(10, 10), (11, 11)]] )
def time_Linearity(self): mm.Linearity(self.df_streets)