diff options
author | bsimon <bsimon@stsci.edu> | 2015-03-12 15:11:55 -0400 |
---|---|---|
committer | bsimon <bsimon@stsci.edu> | 2015-03-12 15:11:55 -0400 |
commit | 761ea7356c47cefe8b6f7afb2433dc74ec370837 (patch) | |
tree | 444b98359731c888116d3b9b8b6aa3c2ee5b3c79 /stsci | |
parent | bc05cd7bf62b2a7dba09ddf8ecbd770c094a76a8 (diff) | |
download | stsci.sphere-761ea7356c47cefe8b6f7afb2433dc74ec370837.tar.gz |
Ypdated code to be Python 2 and 3 compatible
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@38257 fe389314-cf27-0410-b35b-8c050e845b92
Former-commit-id: ea687efdbbc2377ad0a69d27cf92e381035ed937
Diffstat (limited to 'stsci')
-rw-r--r-- | stsci/sphere/test/test_intersection.py | 7 | ||||
-rw-r--r-- | stsci/sphere/test/test_union.py | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/stsci/sphere/test/test_intersection.py b/stsci/sphere/test/test_intersection.py index e837512..9b01d8b 100644 --- a/stsci/sphere/test/test_intersection.py +++ b/stsci/sphere/test/test_intersection.py @@ -1,6 +1,7 @@ -from __future__ import print_function, absolute_import +from __future__ import print_function, absolute_import, division # STDLIB +import codecs import functools import itertools import math @@ -179,8 +180,8 @@ def test_difficult_intersections(): lines = fd.readlines() def to_array(line): - x = np.frombuffer(line.strip().decode('hex'), dtype='<f8') - return x.reshape((len(x) / 3, 3)) + x = np.frombuffer(codecs.decode(line.strip(), 'hex_codec'), dtype='<f8') + return x.reshape((len(x) // 3, 3)) for i in range(0, len(lines), 4): Apoints, Ainside, Bpoints, Binside = [ diff --git a/stsci/sphere/test/test_union.py b/stsci/sphere/test/test_union.py index a6e5793..5559c87 100644 --- a/stsci/sphere/test/test_union.py +++ b/stsci/sphere/test/test_union.py @@ -1,6 +1,7 @@ -from __future__ import print_function, absolute_import +from __future__ import print_function, absolute_import, division # STDLIB +import codecs import functools import itertools import math @@ -199,8 +200,8 @@ def test_difficult_unions(): lines = fd.readlines() def to_array(line): - x = np.frombuffer(line.strip().decode('hex'), dtype='<f8') - return x.reshape((len(x) / 3, 3)) + x = np.frombuffer(codecs.decode(line.strip(), 'hex_codec'), dtype='<f8') + return x.reshape((len(x) // 3, 3)) polys = [] for i in range(0, len(lines), 2): @@ -209,7 +210,7 @@ def test_difficult_unions(): poly = polygon.SphericalPolygon(points, inside) polys.append(poly) - polygon.SphericalPolygon.multi_union(polys[:len(polys)/2]) + polygon.SphericalPolygon.multi_union(polys[:len(polys)//2]) if __name__ == '__main__': |