[cc-commits] [SCM] license.rdf (cc.licenserdf) (branch packageify) updated. b905410e614baf0a47bdb7ca0efd5456316825c5
git version control
git at a7.creativecommons.org
Mon Mar 29 14:17:14 EDT 2010
The branch, packageify has been updated
via b905410e614baf0a47bdb7ca0efd5456316825c5 (commit)
via 61614fcba39d4d4a5b21d326eca99122e47f48c6 (commit)
from 0654d8f1ba0400e1e9dd3ef3a3b7efeb5e2179e7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b905410e614baf0a47bdb7ca0efd5456316825c5
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Mon Mar 29 13:20:56 2010 -0500
Move the PrinterCollector and stuffy into tests/util.py module
commit 61614fcba39d4d4a5b21d326eca99122e47f48c6
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date: Mon Mar 29 13:17:22 2010 -0500
Unused variable declaration/assignment
-----------------------------------------------------------------------
Summary of changes (followed by patch):
cc/licenserdf/tests/test_jurisdiction_tool.py | 27 ++----------------------
cc/licenserdf/tests/util.py | 21 +++++++++++++++++++
2 files changed, 24 insertions(+), 24 deletions(-)
create mode 100644 cc/licenserdf/tests/util.py
diff --git a/cc/licenserdf/tests/test_jurisdiction_tool.py b/cc/licenserdf/tests/test_jurisdiction_tool.py
index dad520a..3d63cbb 100644
--- a/cc/licenserdf/tests/test_jurisdiction_tool.py
+++ b/cc/licenserdf/tests/test_jurisdiction_tool.py
@@ -1,20 +1,14 @@
-import copy
import pkg_resources
import rdflib
+from cc.licenserdf.tests.util import (
+ PrinterCollector, unordered_ensure_printer_printed)
from cc.licenserdf.tools import jurisdiction
class MockOpts(object): pass
-class PrinterCollector(object):
- def __init__(self):
- self.printed_strings = []
-
- def __call__(self, string):
- self.printed_strings.append(string)
-
class MockSaveGraph(object):
def __init__(self):
self.graph = None
@@ -37,19 +31,6 @@ EXPECTED_INFO_OUTPUT_US = [
]
-def _unordered_ensure_printer_printed(printer, expected_output):
- """
- Do an unordered check
- """
- printer_output = copy.copy(printer.printed_strings)
- for line in expected_output:
- assert line in printer_output
- printer_output.pop(printer_output.index(line))
-
- # make sure that we only printed what we expected
- assert len(printer_output) is 0
-
-
def test_info():
opts = MockOpts()
printer = PrinterCollector()
@@ -58,7 +39,7 @@ def test_info():
opts.jurisdiction = ['us']
jurisdiction.info(opts, printer=printer)
- _unordered_ensure_printer_printed(printer, EXPECTED_INFO_OUTPUT_US)
+ unordered_ensure_printer_printed(printer, EXPECTED_INFO_OUTPUT_US)
def test_launch():
@@ -102,8 +83,6 @@ def test_add():
# make sure that we got the right save path
assert graph_saver.save_path == opts.rdf_file
- graph = graph_saver.graph
-
# ensure the jurisdiction exists in the output
## using a list comprehension here because the generators rdflib
## has seem to work weird and aren't list()'able?
diff --git a/cc/licenserdf/tests/util.py b/cc/licenserdf/tests/util.py
new file mode 100644
index 0000000..16bb65e
--- /dev/null
+++ b/cc/licenserdf/tests/util.py
@@ -0,0 +1,21 @@
+import copy
+
+class PrinterCollector(object):
+ def __init__(self):
+ self.printed_strings = []
+
+ def __call__(self, string):
+ self.printed_strings.append(string)
+
+
+def unordered_ensure_printer_printed(printer, expected_output):
+ """
+ Do an unordered check
+ """
+ printer_output = copy.copy(printer.printed_strings)
+ for line in expected_output:
+ assert line in printer_output
+ printer_output.pop(printer_output.index(line))
+
+ # make sure that we only printed what we expected
+ assert len(printer_output) is 0
hooks/post-receive
--
license.rdf (cc.licenserdf)
More information about the cc-commits
mailing list