Permalink
Browse files

Allow single string projections, see #63

  • Loading branch information...
geographika committed Jul 24, 2018
1 parent f4e1cf2 commit ba79d227dd2a85f123accb846d8b132a4f739212
Showing with 21 additions and 4 deletions.
  1. +1 −1 mappyfile.pyproj
  2. +5 −1 mappyfile/pprint.py
  3. +15 −2 tests/test_pprint.py
View
@@ -11,7 +11,7 @@
<Name>mappyfile</Name>
<RootNamespace>mappyfile</RootNamespace>
<InterpreterId>MSBuild|mappyfile3|$(MSBuildProjectFullPath)</InterpreterId>
<StartupFile>tests\mapfiles\profiler.py</StartupFile>
<StartupFile>tests\test_pprint.py</StartupFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
View
@@ -211,7 +211,11 @@ def process_projection(self, key, lst, level):
lines = [self.add_start_line(key, level)]
if len(lst) == 1 and lst[0].upper() == "AUTO":
if self.quoter.is_string(lst):
val = self.quoter.add_quotes(lst)
# the value has been manually set to a single string projection
lines.append(u"{}{}".format(self.whitespace(level, 2), val))
elif len(lst) == 1 and lst[0].upper() == "AUTO":
lines.append(u"{}{}".format(self.whitespace(level, 2), "AUTO"))
else:
for v in lst:
View
@@ -296,6 +296,19 @@ def test_auto_projection():
assert(s == "MAP PROJECTION AUTO END END")
def test_single_string_projection():
d = {
"projection": "init=epsg:4326",
"__type__": "map"
}
pp = PrettyPrinter(indent=0, quote="'", newlinechar=" ")
s = pp.pprint(d)
print(s)
assert(s == "MAP PROJECTION 'init=epsg:4326' END END")
def test_print_boolean():
d = {
"transform": True,
@@ -375,6 +388,6 @@ def run_tests():
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
# test_get_ref_attribute_properties()
run_tests()
test_single_string_projection()
# run_tests()
print("Done!")

0 comments on commit ba79d22

Please sign in to comment.