'Testing LineString objects.'

def test_linestring(self):

    prev = fromstr(u'POINT(0    0)')
    for l in self.geometries.linestrings:
        ls = fromstr(l.wkt)
        self.assertEqual(ls.geom_type, u'LineString')
        self.assertEqual(ls.geom_typeid, 1)
        self.assertEqual(ls.empty, False)
        self.assertEqual(ls.ring, False)
        if hasattr(l, u'centroid'):
            self.assertEqual(l.centroid, ls.centroid.tuple)
        if hasattr(l, u'tup'):
            self.assertEqual(l.tup, ls.tuple)
        self.assertEqual(True, (ls == fromstr(l.wkt)))
        self.assertEqual(False, (ls == prev))
        self.assertRaises(GEOSIndexError, ls.__getitem__, len(ls))
        prev = ls
        self.assertEqual(ls, LineString(ls.tuple))
        self.assertEqual(ls, LineString(*ls.tuple))
        self.assertEqual(ls, LineString([list(tup) for tup in ls.tuple]))
        self.assertEqual(ls.wkt, LineString(*tuple((Point(tup) for tup in ls.tuple))).wkt)
        if numpy:
            self.assertEqual(ls, LineString(numpy.array(ls.tuple)))
