Commit bb742269 by dragonfi

pep8

parent 1c2b94dc
...@@ -77,7 +77,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin): ...@@ -77,7 +77,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
name = self.__class__.__name__ name = self.__class__.__name__
if str(self.type) not in self.valid_types: if str(self.type) not in self.valid_types:
raise ValueError, u'Invalid value for {}.type: `{}`'.format(name, self.type) raise ValueError('Invalid value for {}.type: `{}`'.format(name, self.type))
template_path = 'templates/html/{}_{}.html'.format(name.lower(), self.type) template_path = 'templates/html/{}_{}.html'.format(name.lower(), self.type)
html = render_js_template(template_path, { html = render_js_template(template_path, {
......
...@@ -98,8 +98,8 @@ class MentoringTableColumnBlock(LightChild): ...@@ -98,8 +98,8 @@ class MentoringTableColumnBlock(LightChild):
""" """
The content of the column The content of the column
""" """
fragment, named_children = self.get_children_fragment(context, fragment, named_children = self.get_children_fragment(
view_name='mentoring_table_view', context, view_name='mentoring_table_view',
not_instance_of=MentoringTableColumnHeaderBlock) not_instance_of=MentoringTableColumnHeaderBlock)
fragment.add_content(render_template('templates/html/mentoring-table-column.html', { fragment.add_content(render_template('templates/html/mentoring-table-column.html', {
'self': self, 'self': self,
...@@ -111,8 +111,8 @@ class MentoringTableColumnBlock(LightChild): ...@@ -111,8 +111,8 @@ class MentoringTableColumnBlock(LightChild):
""" """
The content of the column's header The content of the column's header
""" """
fragment, named_children = self.get_children_fragment(context, fragment, named_children = self.get_children_fragment(
view_name='mentoring_table_header_view', context, view_name='mentoring_table_header_view',
instance_of=MentoringTableColumnHeaderBlock) instance_of=MentoringTableColumnHeaderBlock)
fragment.add_content(render_template('templates/html/mentoring-table-header.html', { fragment.add_content(render_template('templates/html/mentoring-table-header.html', {
'self': self, 'self': self,
...@@ -131,4 +131,3 @@ class MentoringTableColumnHeaderBlock(LightChild): ...@@ -131,4 +131,3 @@ class MentoringTableColumnHeaderBlock(LightChild):
fragment = super(MentoringTableColumnHeaderBlock, self).children_view(context) fragment = super(MentoringTableColumnHeaderBlock, self).children_view(context)
fragment.add_content(unicode(self.content)) fragment.add_content(unicode(self.content))
return fragment return fragment
...@@ -33,6 +33,7 @@ from .utils import load_scenarios_from_path ...@@ -33,6 +33,7 @@ from .utils import load_scenarios_from_path
# Classes ########################################################### # Classes ###########################################################
class MentoringBaseTest(SeleniumTest): class MentoringBaseTest(SeleniumTest):
def setUp(self): def setUp(self):
...@@ -57,7 +58,6 @@ class MentoringBaseTest(SeleniumTest): ...@@ -57,7 +58,6 @@ class MentoringBaseTest(SeleniumTest):
wait = WebDriverWait(submit, 10) wait = WebDriverWait(submit, 10)
wait.until(lambda s: not s.is_enabled(), "{} should be disabled".format(submit.text)) wait.until(lambda s: not s.is_enabled(), "{} should be disabled".format(submit.text))
def go_to_page(self, page_name, css_selector='div.mentoring'): def go_to_page(self, page_name, css_selector='div.mentoring'):
""" """
Navigate to the page `page_name`, as listed on the workbench home Navigate to the page `page_name`, as listed on the workbench home
...@@ -68,4 +68,3 @@ class MentoringBaseTest(SeleniumTest): ...@@ -68,4 +68,3 @@ class MentoringBaseTest(SeleniumTest):
time.sleep(1) time.sleep(1)
mentoring = self.browser.find_element_by_css_selector(css_selector) mentoring = self.browser.find_element_by_css_selector(css_selector)
return mentoring return mentoring
...@@ -45,10 +45,9 @@ def commas_to_set(commas_str): ...@@ -45,10 +45,9 @@ def commas_to_set(commas_str):
else: else:
return set(commas_str.split(',')) return set(commas_str.split(','))
# Classes ########################################################### # Classes ###########################################################
class TipBlock(LightChild): class TipBlock(LightChild):
""" """
Each choice can define a tip depending on selection Each choice can define a tip depending on selection
......
...@@ -33,6 +33,7 @@ log = logging.getLogger(__name__) ...@@ -33,6 +33,7 @@ log = logging.getLogger(__name__)
# Classes ########################################################### # Classes ###########################################################
class TitleBlock(LightChild): class TitleBlock(LightChild):
""" """
A simple html representation of a title, with the mentoring weight. A simple html representation of a title, with the mentoring weight.
......
...@@ -98,4 +98,3 @@ class AnswerBlockTest(MentoringBaseTest): ...@@ -98,4 +98,3 @@ class AnswerBlockTest(MentoringBaseTest):
# Submit is disabled after submission # Submit is disabled after submission
self.wait_until_disabled(submit) self.wait_until_disabled(submit)
...@@ -76,7 +76,9 @@ class MentoringProgressionTest(MentoringBaseTest): ...@@ -76,7 +76,9 @@ class MentoringProgressionTest(MentoringBaseTest):
messages = mentoring.find_element_by_css_selector('.messages') messages = mentoring.find_element_by_css_selector('.messages')
self.assertTrue(messages.is_displayed()) self.assertTrue(messages.is_displayed())
self.assertIn('You need to complete all previous steps before being able to complete the current one.', messages.text) self.assertIn(
'You need to complete all previous steps before being able to complete the current one.',
messages.text)
mentoring = self.go_to_page('Progression 2') mentoring = self.go_to_page('Progression 2')
warning = mentoring.find_element_by_css_selector('.warning') warning = mentoring.find_element_by_css_selector('.warning')
......
...@@ -57,4 +57,3 @@ class MentoringTableBlockTest(MentoringBaseTest): ...@@ -57,4 +57,3 @@ class MentoringTableBlockTest(MentoringBaseTest):
self.assertEqual(len(rows), 2) self.assertEqual(len(rows), 2)
self.assertEqual(rows[0].text, 'This is the answer #1') self.assertEqual(rows[0].text, 'This is the answer #1')
self.assertEqual(rows[1].text, 'This is the answer #2') self.assertEqual(rows[1].text, 'This is the answer #2')
...@@ -6,6 +6,7 @@ from mentoring import MentoringBlock ...@@ -6,6 +6,7 @@ from mentoring import MentoringBlock
import mentoring import mentoring
from mentoring.step import StepMixin, StepParentMixin from mentoring.step import StepMixin, StepParentMixin
class Parent(StepParentMixin): class Parent(StepParentMixin):
def get_children_objects(self): def get_children_objects(self):
return list(self._children) return list(self._children)
...@@ -18,10 +19,15 @@ class Parent(StepParentMixin): ...@@ -18,10 +19,15 @@ class Parent(StepParentMixin):
except AttributeError: except AttributeError:
pass pass
class Step(StepMixin): class Step(StepMixin):
def __init__(self): pass def __init__(self):
pass
class NotAStep(object):
pass
class NotAStep(object): pass
class TestStepMixin(unittest.TestCase): class TestStepMixin(unittest.TestCase):
def test_single_step_is_returned_correctly(self): def test_single_step_is_returned_correctly(self):
...@@ -39,7 +45,6 @@ class TestStepMixin(unittest.TestCase): ...@@ -39,7 +45,6 @@ class TestStepMixin(unittest.TestCase):
self.assertSequenceEqual(block.steps, [step1, step2]) self.assertSequenceEqual(block.steps, [step1, step2])
def test_proper_number_is_returned_for_step(self): def test_proper_number_is_returned_for_step(self):
block = Parent() block = Parent()
step1 = Step() step1 = Step()
...@@ -73,4 +78,3 @@ class TestStepMixin(unittest.TestCase): ...@@ -73,4 +78,3 @@ class TestStepMixin(unittest.TestCase):
self.assertFalse(step1.lonely_step) self.assertFalse(step1.lonely_step)
self.assertFalse(step2.lonely_step) self.assertFalse(step2.lonely_step)
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