Skip to content

Commit

Permalink
adding vector __str__ method and start of testsgi
Browse files Browse the repository at this point in the history
  • Loading branch information
wbierbower committed Jul 30, 2015
1 parent bff7f3d commit eb5355c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fauxgeo/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ def _delete(self):
os.remove(fp+ext)

def __str__(self):
return "<vector object at " + self.uri + ">"
string = '\nVector object -----'
string += '\nuri:' + self.uri
string += '\nwkt:' + self.get_geometry().__str__()
string += '\nprojection:' + self.get_projection_wkt()
string += '\n'
return string

def __len__(self):
return self.feature_count()
Expand Down
33 changes: 33 additions & 0 deletions tests/test_vector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
test_vector
----------------------------------
Tests for Vector class.
python -m unittest test_vector
"""

import unittest
import os
import tempfile

import shapely

from fauxgeo import Vector

class TestVectorString(unittest.TestCase):

def setUp(self):
pass

def test__str__(self):
s = shapely.geometry.polygon.Polygon([(0,0), (0,1), (1,1), (1,0)])
v = Vector.from_shapely(s, 4326)
print v


if __name__ == '__main__':
unittest.main()

0 comments on commit eb5355c

Please sign in to comment.