Skip to content

Commit

Permalink
Merge pull request calvinmetcalf#20 from calvinmetcalf/scw-python3
Browse files Browse the repository at this point in the history
Further Python 3 + testing updates
  • Loading branch information
scw committed Oct 1, 2015
2 parents a697b06 + 067b547 commit 111bfd8
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 39 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
version="0.1.0",
license="BSD",
packages=find_packages(),
test_suite = 'test.topojson_test'
test_suite="tests"
)
Empty file removed test/__init__.py
Empty file.
37 changes: 0 additions & 37 deletions test/topojson_test.py

This file was deleted.

1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .topojson_test import TestTopojson
21 changes: 21 additions & 0 deletions tests/data/square.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"description": "A 20°x20° box surrounding Null Island."
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-10, 10],
[ 10, 10],
[ 10, -10],
[-10, -10],
[-10, 10]
]]
}
}
]
}
15 changes: 15 additions & 0 deletions tests/topojson_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import json
import unittest

from topojson.conversion import convert


class TestTopojson(unittest.TestCase):

def setUp(self):
with open("tests/data/square.geojson") as f:
self.square_geojson = json.load(f)

def test_convert_geojson_to_topojson(self):
tj = convert(self.square_geojson)
self.assertEqual(tj['type'], 'Topology')
3 changes: 2 additions & 1 deletion topojson/coordinatesystems.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding=utf8
from __future__ import division
from math import sqrt, pi, cos, sin, atan2, tan, atan, asin

PI4 = pi / 4
Expand Down Expand Up @@ -115,4 +116,4 @@ def distance(self, x0, y0, x1, y1):
return 2.0 * asin(sqrt(self.haversin(y1 - y0) + cos(y0) * cos(y1) * self.haversin(x1 - x0)))


systems = {'cartesian': Cartesian(), 'spherical': Spherical()}
systems = {'cartesian': Cartesian(), 'spherical': Spherical()}
2 changes: 2 additions & 0 deletions topojson/hashtable.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import division
from math import ceil, log


def hasher(size):
mask = int(size) - 1

Expand Down
1 change: 1 addition & 0 deletions topojson/simplify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#from https://github.com/omarestrella/simplify.py
from __future__ import division
from .mytypes import Types

def getSquareDistance(p1, p2):
Expand Down
1 change: 1 addition & 0 deletions topojson/topology.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding=utf8
from __future__ import division
from .mytypes import Types
from .stitchpoles import stitch
from .coordinatesystems import systems
Expand Down

0 comments on commit 111bfd8

Please sign in to comment.