projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Take test coverage back to 100%
[open-adventure.git]
/
tests
/
coverage_dungeon.py
diff --git
a/tests/coverage_dungeon.py
b/tests/coverage_dungeon.py
index 365995ce644598d9178f8cd976e8a19b50a052c9..182930cb878511ea881a3473fb28ff71e119f80e 100755
(executable)
--- a/
tests/coverage_dungeon.py
+++ b/
tests/coverage_dungeon.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
# This is the open-adventure dungeon text coverage report generator. It
# consumes a YAML description of the dungeon and determines whether the
# This is the open-adventure dungeon text coverage report generator. It
# consumes a YAML description of the dungeon and determines whether the
@@
-71,10
+71,10
@@
def search(needle, haystack):
needle_san = re.escape(needle) \
.replace("\\n", "\n") \
.replace("\\t", "\t") \
needle_san = re.escape(needle) \
.replace("\\n", "\n") \
.replace("\\t", "\t") \
- .replace("
\
%S", ".*") \
- .replace("
\
%s", ".*") \
- .replace("
\
%d", ".*") \
- .replace("
\
%V", ".*")
+ .replace("%S", ".*") \
+ .replace("%s", ".*") \
+ .replace("%d", ".*") \
+ .replace("%V", ".*")
return re.search(needle_san, haystack)
return re.search(needle_san, haystack)
@@
-197,7
+197,7
@@
if __name__ == "__main__":
# load DB
try:
with open(YAML_PATH, "r") as f:
# load DB
try:
with open(YAML_PATH, "r") as f:
- db = yaml.load(f)
+ db = yaml.
safe_
load(f)
except IOError as e:
print('ERROR: could not load {} ({}})'.format(YAML_PATH, e.strerror))
exit(-1)
except IOError as e:
print('ERROR: could not load {} ({}})'.format(YAML_PATH, e.strerror))
exit(-1)
@@
-223,7
+223,7
@@
if __name__ == "__main__":
category["percent"] = (category["covered"] / float(category["total"])) * 100
# render section header
category["percent"] = (category["covered"] / float(category["total"])) * 100
# render section header
- cat_messages =
sorted
(category["messages"].items())
+ cat_messages =
list
(category["messages"].items())
cat_keys = cat_messages[0][1].keys()
headers_html = ""
colspan = 10 - len(cat_keys)
cat_keys = cat_messages[0][1].keys()
headers_html = ""
colspan = 10 - len(cat_keys)