コード例 #1
0
ファイル: test_step.py プロジェクト: htmue/python-wishes
 def test_can_fill_its_hashes_from_example(self):
     hashes = Hashes(keys=('key', '<key>'), values=[('<value>', 'value')])
     outline_step = Step('Given', 'a step', hashes=hashes)
     filled_step = outline_step.fill_from_example({'<key>': 'a key', '<value>': 'a value'})
     filled_step.hashes |should| each_be_equal_to([
         {'a key': 'value', 'key': 'a value'},
     ])
コード例 #2
0
 def test_can_fill_its_multiline_from_example(self):
     outline_step = Step('Given',
                         'a step',
                         multilines=['with <placeholder>\n'])
     filled_step = outline_step.fill_from_example(
         {'<placeholder>': 'replacement'})
     filled_step.multiline | should | be_equal_to('with replacement\n')
コード例 #3
0
ファイル: test_step.py プロジェクト: htmue/python-wishes
 def test_passes_capture_groups_to_definition(self):
     @step('this is (.*)')
     def this_is_captured(step, capture):
         my_world.capture = capture
     step_ = Step('Given', 'this is captured')
     my_world = World()
     my_world.capture = None
     step_.run()
     my_world.capture |should| be_equal_to('captured')
コード例 #4
0
ファイル: test_step.py プロジェクト: htmue/python-wishes
 def test_can_run_if_defined(self):
     @step('there is a step')
     def there_is_a_step(step):
         world.run_count += 1
     step_ = Step('Given', 'there is a step')
     world = World()
     world.run_count = 0
     step_.run()
     world.run_count |should| be(1)
コード例 #5
0
    def test_passes_capture_groups_to_definition(self):
        @step('this is (.*)')
        def this_is_captured(step, capture):
            my_world.capture = capture

        step_ = Step('Given', 'this is captured')
        my_world = World()
        my_world.capture = None
        step_.run()
        my_world.capture | should | be_equal_to('captured')
コード例 #6
0
    def test_can_run_if_defined(self):
        @step('there is a step')
        def there_is_a_step(step):
            world.run_count += 1

        step_ = Step('Given', 'there is a step')
        world = World()
        world.run_count = 0
        step_.run()
        world.run_count | should | be(1)
コード例 #7
0
 def test_can_fill_its_hashes_from_example(self):
     hashes = Hashes(keys=('key', '<key>'), values=[('<value>', 'value')])
     outline_step = Step('Given', 'a step', hashes=hashes)
     filled_step = outline_step.fill_from_example({
         '<key>': 'a key',
         '<value>': 'a value'
     })
     filled_step.hashes | should | each_be_equal_to([
         {
             'a key': 'value',
             'key': 'a value'
         },
     ])
コード例 #8
0
    def test_is_looked_up_case_insensitive(self):
        @step('miXed Case definItion')
        def mixed_case_definition(step):
            pass

        step_ = Step('Given', 'a MixeD case Definition')
        step_ | should | be_defined
コード例 #9
0
    def test_knows_if_it_is_defined(self):
        @step('there is a step')
        def there_is_a_step(step):
            pass

        step_ = Step('Given', 'there is a step')
        step_.is_defined | should | be(True)
コード例 #10
0
ファイル: test_step.py プロジェクト: htmue/python-wishes
 def test_can_fill_its_multiline_from_example(self):
     outline_step = Step('Given', 'a step', multilines=['with <placeholder>\n'])
     filled_step = outline_step.fill_from_example({'<placeholder>': 'replacement'})
     filled_step.multiline |should| be_equal_to('with replacement\n')
コード例 #11
0
ファイル: test_step.py プロジェクト: htmue/python-wishes
 def test_can_fill_itself_from_example(self):
     outline_step = Step('Given', 'an <outlined> step')
     filled_step = outline_step.fill_from_example({'<outlined>': 'filled'})
     filled_step.text |should| be_equal_to('an filled step')
コード例 #12
0
 def test_can_fill_itself_from_example(self):
     outline_step = Step('Given', 'an <outlined> step')
     filled_step = outline_step.fill_from_example({'<outlined>': 'filled'})
     filled_step.text | should | be_equal_to('an filled step')
コード例 #13
0
 def test_knows_if_it_is_undefined(self):
     step = Step('Given', 'there is a step')
     step.is_undefined | should | be(True)
コード例 #14
0
 def test_can_be_created(self):
     step = Step('Given', 'there is a step')