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
90f7e6e9
Commit
90f7e6e9
authored
Jul 16, 2014
by
Christian Ledermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10 from IanLee1521/master
Minor test case additions & lxml warning Thanks 8-)
parents
842c6531
3adddc93
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
fastkml/config.py
fastkml/config.py
+4
-0
fastkml/test_main.py
fastkml/test_main.py
+52
-1
No files found.
fastkml/config.py
View file @
90f7e6e9
...
@@ -16,10 +16,14 @@
...
@@ -16,10 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""frequently used constants and abstract base classes"""
"""frequently used constants and abstract base classes"""
import
logging
logger
=
logging
.
getLogger
(
'fastkml.config'
)
try
:
try
:
from
lxml
import
etree
from
lxml
import
etree
LXML
=
True
LXML
=
True
except
ImportError
:
except
ImportError
:
logger
.
warning
(
'Package `lxml` missing. Pretty print will be disabled'
)
import
xml.etree.ElementTree
as
etree
import
xml.etree.ElementTree
as
etree
LXML
=
False
LXML
=
False
...
...
fastkml/test_main.py
View file @
90f7e6e9
...
@@ -686,7 +686,6 @@ class KmlFromStringTestCase( unittest.TestCase ):
...
@@ -686,7 +686,6 @@ class KmlFromStringTestCase( unittest.TestCase ):
self
.
assertTrue
(
'Diffrent Snippet'
in
k
.
to_string
())
self
.
assertTrue
(
'Diffrent Snippet'
in
k
.
to_string
())
class
StyleTestCase
(
unittest
.
TestCase
):
class
StyleTestCase
(
unittest
.
TestCase
):
def
test_styleurl
(
self
):
def
test_styleurl
(
self
):
...
@@ -711,7 +710,59 @@ class StyleTestCase( unittest.TestCase ):
...
@@ -711,7 +710,59 @@ class StyleTestCase( unittest.TestCase ):
self
.
assertEqual
(
f
.
to_string
(),
f2
.
to_string
())
self
.
assertEqual
(
f
.
to_string
(),
f2
.
to_string
())
class
StyleUsageTestCase
(
unittest
.
TestCase
):
def
test_create_document_style
(
self
):
style
=
styles
.
Style
(
styles
=
[
styles
.
PolyStyle
(
color
=
'7f000000'
)])
doc
=
kml
.
Document
(
styles
=
[
style
])
doc2
=
kml
.
Document
()
doc2
.
append_style
(
style
)
expected
=
"""
<kml:Document xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:visibility>1</kml:visibility>
<kml:Style>
<kml:PolyStyle>
<kml:color>7f000000</kml:color>
<kml:fill>1</kml:fill>
<kml:outline>1</kml:outline>
</kml:PolyStyle>
</kml:Style>
</kml:Document>
"""
doc3
=
kml
.
Document
()
doc3
.
from_string
(
expected
)
self
.
assertEqual
(
doc
.
to_string
(),
doc2
.
to_string
())
self
.
assertEqual
(
doc2
.
to_string
(),
doc3
.
to_string
())
self
.
assertEqual
(
doc
.
to_string
(),
doc3
.
to_string
())
def
test_create_placemark_style
(
self
):
style
=
styles
.
Style
(
styles
=
[
styles
.
PolyStyle
(
color
=
'7f000000'
)])
place
=
kml
.
Placemark
(
styles
=
[
style
])
place2
=
kml
.
Placemark
()
place2
.
append_style
(
style
)
expected
=
"""
<kml:Placemark xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:visibility>1</kml:visibility>
<kml:Style>
<kml:PolyStyle>
<kml:color>7f000000</kml:color>
<kml:fill>1</kml:fill>
<kml:outline>1</kml:outline>
</kml:PolyStyle>
</kml:Style>
</kml:Placemark>
"""
place3
=
kml
.
Placemark
()
place3
.
from_string
(
expected
)
self
.
assertEqual
(
place
.
to_string
(),
place2
.
to_string
())
self
.
assertEqual
(
place2
.
to_string
(),
place3
.
to_string
())
self
.
assertEqual
(
place
.
to_string
(),
place3
.
to_string
())
class
StyleFromStringTestCase
(
unittest
.
TestCase
):
class
StyleFromStringTestCase
(
unittest
.
TestCase
):
...
...
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