Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fastkml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
fastkml
Commits
ea18d2d4
Commit
ea18d2d4
authored
Aug 01, 2012
by
Christian Ledermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make test run on python3
parent
f21c702a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
25 deletions
+35
-25
fastkml/tests.py
fastkml/tests.py
+35
-25
No files found.
fastkml/tests.py
View file @
ea18d2d4
...
@@ -16,17 +16,29 @@
...
@@ -16,17 +16,29 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import
unittest
import
unittest
try
:
from
fastkml
import
kml
from
fastkml
import
styles
from
fastkml
import
base
from
fastkml
import
atom
from
fastkml
import
config
except
ImportError
:
import
kml
import
styles
import
base
import
atom
import
config
from
fastkml
import
kml
from
fastkml
import
styles
from
fastkml
import
base
from
fastkml
import
atom
from
fastkml
import
config
import
datetime
import
datetime
import
xml.etree.ElementTree
as
etree
import
xml.etree.ElementTree
as
etree
from
fastkml.geometry
import
Point
,
LineString
,
Polygon
try
:
from
fastkml.geometry
import
MultiPoint
,
MultiLineString
,
MultiPolygon
from
fastkml.geometry
import
Point
,
LineString
,
Polygon
from
fastkml.geometry
import
LinearRing
from
fastkml.geometry
import
MultiPoint
,
MultiLineString
,
MultiPolygon
from
fastkml.geometry
import
LinearRing
except
ImportError
:
from
geometry
import
Point
,
LineString
,
Polygon
from
geometry
import
MultiPoint
,
MultiLineString
,
MultiPolygon
from
geometry
import
LinearRing
class
BaseClassesTestCase
(
unittest
.
TestCase
):
class
BaseClassesTestCase
(
unittest
.
TestCase
):
""" BaseClasses must raise a NotImplementedError on etree_element
""" BaseClasses must raise a NotImplementedError on etree_element
...
@@ -116,7 +128,6 @@ class BuildKmlTestCase(unittest.TestCase):
...
@@ -116,7 +128,6 @@ class BuildKmlTestCase(unittest.TestCase):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_folder
(
self
):
def
test_folder
(
self
):
""" KML file with folders """
""" KML file with folders """
...
@@ -134,7 +145,7 @@ class BuildKmlTestCase(unittest.TestCase):
...
@@ -134,7 +145,7 @@ class BuildKmlTestCase(unittest.TestCase):
s
=
k
.
to_string
()
s
=
k
.
to_string
()
k2
.
from_string
(
s
)
k2
.
from_string
(
s
)
self
.
assertEqual
(
s
,
k2
.
to_string
())
self
.
assertEqual
(
s
,
k2
.
to_string
())
print
s
def
test_placemark
(
self
):
def
test_placemark
(
self
):
k
=
kml
.
KML
()
k
=
kml
.
KML
()
...
@@ -149,7 +160,7 @@ class BuildKmlTestCase(unittest.TestCase):
...
@@ -149,7 +160,7 @@ class BuildKmlTestCase(unittest.TestCase):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_document
(
self
):
def
test_document
(
self
):
k
=
kml
.
KML
()
k
=
kml
.
KML
()
...
@@ -173,7 +184,7 @@ class BuildKmlTestCase(unittest.TestCase):
...
@@ -173,7 +184,7 @@ class BuildKmlTestCase(unittest.TestCase):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_author
(
self
):
def
test_author
(
self
):
...
@@ -240,7 +251,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -240,7 +251,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_folders
(
self
):
def
test_folders
(
self
):
...
@@ -291,7 +302,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -291,7 +302,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_placemark
(
self
):
def
test_placemark
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -312,7 +323,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -312,7 +323,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_polygon
(
self
):
def
test_polygon
(
self
):
...
@@ -330,7 +341,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -330,7 +341,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_multipoints
(
self
):
def
test_multipoints
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -386,7 +397,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -386,7 +397,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_multilinestrings
(
self
):
def
test_multilinestrings
(
self
):
...
@@ -410,7 +421,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -410,7 +421,7 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_multipolygon
(
self
):
def
test_multipolygon
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -498,7 +509,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
...
@@ -498,7 +509,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_iconstyle
(
self
):
def
test_iconstyle
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -530,7 +541,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
...
@@ -530,7 +541,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_linestyle
(
self
):
def
test_linestyle
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -558,7 +569,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
...
@@ -558,7 +569,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_polystyle
(
self
):
def
test_polystyle
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -587,7 +598,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
...
@@ -587,7 +598,7 @@ class StyleFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_styles
(
self
):
def
test_styles
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -628,7 +639,6 @@ class StyleFromStringTestCase( unittest.TestCase ):
...
@@ -628,7 +639,6 @@ class StyleFromStringTestCase( unittest.TestCase ):
k2
=
kml
.
KML
()
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
print
k
.
to_string
()
def
test_stylemapurl
(
self
):
def
test_stylemapurl
(
self
):
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
doc
=
"""<?xml version="1.0" encoding="UTF-8"?>
...
@@ -852,13 +862,13 @@ class AtomTestCase( unittest.TestCase ):
...
@@ -852,13 +862,13 @@ class AtomTestCase( unittest.TestCase ):
l
=
atom
.
Link
(
href
=
"http://localhost/"
,
rel
=
"alternate"
)
l
=
atom
.
Link
(
href
=
"http://localhost/"
,
rel
=
"alternate"
)
self
.
assertEqual
(
l
.
href
,
"http://localhost/"
)
self
.
assertEqual
(
l
.
href
,
"http://localhost/"
)
self
.
assertEqual
(
l
.
rel
,
"alternate"
)
self
.
assertEqual
(
l
.
rel
,
"alternate"
)
l
.
title
=
u
"Title"
l
.
title
=
"Title"
l
.
type
=
"text/html"
l
.
type
=
"text/html"
l
.
hreflang
=
'en'
l
.
hreflang
=
'en'
l
.
lenght
=
"4096"
l
.
lenght
=
"4096"
self
.
assertTrue
(
'href="http://localhost/"'
in
l
.
to_string
())
self
.
assertTrue
(
'href="http://localhost/"'
in
l
.
to_string
())
self
.
assertTrue
(
'rel="alternate"'
in
l
.
to_string
())
self
.
assertTrue
(
'rel="alternate"'
in
l
.
to_string
())
self
.
assertTrue
(
u
'title="Title"'
in
l
.
to_string
())
self
.
assertTrue
(
'title="Title"'
in
l
.
to_string
())
self
.
assertTrue
(
'hreflang="en"'
in
l
.
to_string
())
self
.
assertTrue
(
'hreflang="en"'
in
l
.
to_string
())
self
.
assertTrue
(
'type="text/html"'
in
l
.
to_string
())
self
.
assertTrue
(
'type="text/html"'
in
l
.
to_string
())
self
.
assertTrue
(
'lenght="4096"'
in
l
.
to_string
())
self
.
assertTrue
(
'lenght="4096"'
in
l
.
to_string
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment