Example #1
0
def test_scenario_description():
    "Scenario description takes a scenario, filename and a string, and keeps " \
    "the relative path for filename and line"

    string = '''
    asdasdasdasd
    8fg6f8g23o83g
    dfjdsfjsdScenario: NAMEOFSCENARIOjdkasbdkajsb
Fsdad
          Scenario: NAMEOFSCENARIO
 da  sodnasndjasdasd
    '''

    class ScenarioFake:
        name = 'NAMEOFSCENARIO'

    description = core.ScenarioDescription(ScenarioFake, __file__, string,
                                           core.Language())
    assert_equals(description.file, core.fs.relpath(__file__))
    assert_not_equals(description.file, __file__)
    assert_equals(description.line, 6)
Example #2
0
def test_feature_description():
    "Feature description takes a feature, filename and original string, and keeps " \
    "the relative path for filename, line and description lines"

    string = u'''
    # lang: en-us
    Feature: FEATURE NAME! #@@$%ˆ&*)(*%$E#
    here comes
    the description
    of the scenario
    really!
    '''

    class FakeFeature:
        description = 'the description\nof the scenario\n'

    description = core.FeatureDescription(FakeFeature, __file__, string,
                                          core.Language())
    assert_equals(description.file, core.fs.relpath(__file__))
    assert_not_equals(description.file, __file__)
    assert_equals(description.line, 3)
    assert_equals(description.description_at, (5, 6))