Commit 1c98d5fc by Jay Zoldak

Fix modulestore tests for pep8 violations

parent 0605c941
...@@ -46,10 +46,10 @@ class XModuleCourseFactory(Factory): ...@@ -46,10 +46,10 @@ class XModuleCourseFactory(Factory):
new_course.metadata['start'] = stringify_time(gmtime()) new_course.metadata['start'] = stringify_time(gmtime())
new_course.tabs = [{"type": "courseware"}, new_course.tabs = [{"type": "courseware"},
{"type": "course_info", "name": "Course Info"}, {"type": "course_info", "name": "Course Info"},
{"type": "discussion", "name": "Discussion"}, {"type": "discussion", "name": "Discussion"},
{"type": "wiki", "name": "Wiki"}, {"type": "wiki", "name": "Wiki"},
{"type": "progress", "name": "Progress"}] {"type": "progress", "name": "Progress"}]
# Update the data in the mongo datastore # Update the data in the mongo datastore
store.update_metadata(new_course.location.url(), new_course.own_metadata) store.update_metadata(new_course.location.url(), new_course.own_metadata)
......
...@@ -119,11 +119,11 @@ def test_equality(): ...@@ -119,11 +119,11 @@ def test_equality():
# All the cleaning functions should do the same thing with these # All the cleaning functions should do the same thing with these
general_pairs = [('', ''), general_pairs = [('', ''),
(' ', '_'), (' ', '_'),
('abc,', 'abc_'), ('abc,', 'abc_'),
('ab fg!@//\\aj', 'ab_fg_aj'), ('ab fg!@//\\aj', 'ab_fg_aj'),
(u"ab\xA9", "ab_"), # no unicode allowed for now (u"ab\xA9", "ab_"), # no unicode allowed for now
] ]
def test_clean(): def test_clean():
...@@ -131,7 +131,7 @@ def test_clean(): ...@@ -131,7 +131,7 @@ def test_clean():
('a:b', 'a_b'), # no colons in non-name components ('a:b', 'a_b'), # no colons in non-name components
('a-b', 'a-b'), # dashes ok ('a-b', 'a-b'), # dashes ok
('a.b', 'a.b'), # dot ok ('a.b', 'a.b'), # dot ok
] ]
for input, output in pairs: for input, output in pairs:
assert_equals(Location.clean(input), output) assert_equals(Location.clean(input), output)
...@@ -141,17 +141,17 @@ def test_clean_for_url_name(): ...@@ -141,17 +141,17 @@ def test_clean_for_url_name():
('a:b', 'a:b'), # colons ok in names ('a:b', 'a:b'), # colons ok in names
('a-b', 'a-b'), # dashes ok in names ('a-b', 'a-b'), # dashes ok in names
('a.b', 'a.b'), # dot ok in names ('a.b', 'a.b'), # dot ok in names
] ]
for input, output in pairs: for input, output in pairs:
assert_equals(Location.clean_for_url_name(input), output) assert_equals(Location.clean_for_url_name(input), output)
def test_clean_for_html(): def test_clean_for_html():
pairs = general_pairs + [ pairs = general_pairs + [
("a:b", "a_b"), # no colons for html use ("a:b", "a_b"), # no colons for html use
("a-b", "a-b"), # dashes ok (though need to be replaced in various use locations. ugh.) ("a-b", "a-b"), # dashes ok (though need to be replaced in various use locations. ugh.)
('a.b', 'a_b'), # no dots. ('a.b', 'a_b'), # no dots.
] ]
for input, output in pairs: for input, output in pairs:
assert_equals(Location.clean_for_html(input), output) assert_equals(Location.clean_for_html(input), output)
......
...@@ -12,7 +12,7 @@ def check_path_to_location(modulestore): ...@@ -12,7 +12,7 @@ def check_path_to_location(modulestore):
("edX/toy/2012_Fall", "Overview", "Welcome", None)), ("edX/toy/2012_Fall", "Overview", "Welcome", None)),
("i4x://edX/toy/chapter/Overview", ("i4x://edX/toy/chapter/Overview",
("edX/toy/2012_Fall", "Overview", None, None)), ("edX/toy/2012_Fall", "Overview", None, None)),
) )
course_id = "edX/toy/2012_Fall" course_id = "edX/toy/2012_Fall"
for location, expected in should_work: for location, expected in should_work:
...@@ -20,6 +20,6 @@ def check_path_to_location(modulestore): ...@@ -20,6 +20,6 @@ def check_path_to_location(modulestore):
not_found = ( not_found = (
"i4x://edX/toy/video/WelcomeX", "i4x://edX/toy/course/NotHome" "i4x://edX/toy/video/WelcomeX", "i4x://edX/toy/course/NotHome"
) )
for location in not_found: for location in not_found:
assert_raises(ItemNotFoundError, path_to_location, modulestore, course_id, location) assert_raises(ItemNotFoundError, path_to_location, modulestore, course_id, location)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment