def test_feature_fr_from_string2(): 'Language: FR -> Feature.from_string, alternate name' lang = Language('fr') feature = Feature.from_string(OUTLINED_FEATURE2, language=lang) assert_equals( feature.name, u'Faire plusieur choses en même temps' ) assert_equals( feature.description, u"De façon à automatiser les tests\n" u"En tant que fainéant\n" u"J'utilise les plans de scénario" ) (scenario, ) = feature.scenarios assert_equals( scenario.name, 'Ajouter 2 nombres' ) assert_equals( scenario.outlines, [ {u'input_1':u'20',u'input_2':u'30',u'bouton':u'add',u'output':u'50'}, {u'input_1':u'2',u'input_2':u'5',u'bouton':u'add',u'output':u'7'}, {u'input_1':u'0',u'input_2':u'40',u'bouton':u'add',u'output':u'40'}, ] )
def test_feature_ptbr_from_string(): 'Language: PT-BR -> Feature.from_string' ptbr = Language('pt-br') feature = Feature.from_string(FEATURE, language=ptbr) assert_equals(feature.name, u'Pesquisar alunos com matrícula vencida') assert_equals( feature.description, u"Como gerente financeiro\n" u"Eu quero pesquisar alunos com matrícula vencida\n" u"Para propor um financiamento") (scenario, ) = feature.scenarios assert_equals(scenario.name, 'Pesquisar por nome do curso') assert_equals(scenario.steps[-1].hashes, [ { 'nome': u'João', u'valor devido': 'R$ 512,66' }, { 'nome': u'Maria', u'valor devido': 'R$ 998,41' }, { 'nome': u'Ana', u'valor devido': 'R$ 231,00' }, ])
def test_feature_ptbr_from_string(): 'Language: RU -> Feature.from_string' ru = Language('ru') feature = Feature.from_string(FEATURE, language=ru) assert_equals(feature.name, 'Деление чисел') assert_equals( feature.description, "Поскольку деление сложный процесс и люди часто допускают ошибки\n" "Нужно дать им возможность делить на калькуляторе") (scenario, ) = feature.scenarios assert_equals(scenario.name, 'Целочисленное деление') assert_equals(scenario.steps[-1].hashes, [ { 'делимое': '100', 'делитель': '2', 'частное': '50' }, { 'делимое': '28', 'делитель': '7', 'частное': '4' }, { 'делимое': '0', 'делитель': '5', 'частное': '0' }, ])
def test_scenario_outline3_fr_from_string(): 'Language: FR -> Scenario.from_string, with scenario outline, third case' lang = Language('fr') scenario = Scenario.from_string(OUTLINED_SCENARIO2, language=lang) assert_equals(scenario.name, 'Ajouter 2 nombres') assert_equals(scenario.outlines, [ { 'input_1': '20', 'input_2': '30', 'bouton': 'add', 'output': '50' }, { 'input_1': '2', 'input_2': '5', 'bouton': 'add', 'output': '7' }, { 'input_1': '0', 'input_2': '40', 'bouton': 'add', 'output': '40' }, ])
def test_language_is_english_by_default(): "Language class is english by default" lang = Language() assert_equals(lang.code, 'en') assert_equals(lang.name, 'English') assert_equals(lang.native, 'English') assert_equals(lang.feature, 'Feature') assert_equals(lang.scenario, 'Scenario') assert_equals(lang.examples, 'Examples|Scenarios') assert_equals(lang.scenario_outline, 'Scenario Outline')
def test_language_russian(): 'Language: RU -> Language class supports russian through code "ru"' lang = Language('ru') assert_equals(lang.code, 'ru') assert_equals(lang.name, 'Russian') assert_equals(lang.native, 'Русский') assert_equals(lang.feature, 'Функционал') assert_equals(lang.scenario, 'Сценарий') assert_equals(lang.examples, 'Примеры|Сценарии') assert_equals(lang.scenario_outline, 'Структура сценария')
def test_language_portuguese(): 'Language: PT-BR -> Language class supports portuguese through code "pt-br"' lang = Language('pt-br') assert_equals(lang.code, u'pt-br') assert_equals(lang.name, u'Portuguese') assert_equals(lang.native, u'Português') assert_equals(lang.feature, u'Funcionalidade') assert_equals(lang.scenario, u'Cenário|Cenario') assert_equals(lang.examples, u'Exemplos|Cenários') assert_equals(lang.scenario_outline, u'Esquema do Cenário|Esquema do Cenario')
def test_language_french(): 'Language: FR -> Language class supports french through code "fr"' lang = Language('fr') assert_equals(lang.code, u'fr') assert_equals(lang.name, u'French') assert_equals(lang.native, u'Français') assert_equals(lang.feature, u'Fonctionnalité|Fonction') assert_equals(lang.scenario, u'Scénario') assert_equals(lang.examples, u'Exemples|Scénarios') assert_equals(lang.scenario_outline, u'Plan de Scénario|Plan du Scénario') assert_equals(lang.scenario_separator, u'(Plan de Scénario|Plan du Scénario|Scénario)')
def test_scenario_fr_from_string(): 'Language: FR -> Scenario.from_string' lang = Language('fr') scenario = Scenario.from_string(SCENARIO, language=lang) assert_equals( scenario.name, u'Ajout de plusieurs cursus dans la base de mon université' ) assert_equals( scenario.steps[0].hashes, [ {'Nom': u"Science de l'Informatique", u'Durée': '5 ans'}, {'Nom': u'Nutrition', u'Durée': '4 ans'}, ] )
def test_scenario_outline2_ptbr_from_string(): 'Language: PT-BR -> Scenario.from_string, with scenario outline, second case' ptbr = Language('pt-br') scenario = Scenario.from_string(SCENARIO_OUTLINE2, language=ptbr) assert_equals(scenario.name, 'Cadastrar um aluno no banco de dados') assert_equals(scenario.outlines, [ { 'nome': u'Gabriel', u'idade': '99' }, { 'nome': u'João', u'idade': '100' }, ])
def test_scenario_outline1_ru_from_string(): 'Language: RU -> Scenario.from_string, with scenario outline, first case' ru = Language('ru') scenario = Scenario.from_string(SCENARIO_OUTLINE1, language=ru) assert_equals(scenario.name, 'Заполнение пользователей в базу') assert_equals(scenario.outlines, [ { 'имя': 'Вася', 'возраст': '22' }, { 'имя': 'Петя', 'возраст': '30' }, ])
def test_scenario_ptbr_from_string(): 'Language: PT-BR -> Scenario.from_string' ptbr = Language('pt-br') scenario = Scenario.from_string(SCENARIO, language=ptbr) assert_equals( scenario.name, u'Consolidar o banco de dados de cursos universitários em arquivo texto' ) assert_equals( scenario.steps[0].hashes, [ {'Nome': u'Ciência da Computação', u'Duração': '5 anos'}, {'Nome': u'Nutrição', u'Duração': '4 anos'}, ] )
def test_scenario_outline1_ptbr_from_string(): 'Language: PT-BR -> Scenario.from_string, with scenario outline, first case' ptbr = Language('pt-br') scenario = Scenario.from_string(SCENARIO_OUTLINE1, language=ptbr) assert_equals(scenario.name, 'Cadastrar um aluno no banco de dados') assert_equals(scenario.outlines, [ { 'nome': 'Gabriel', 'idade': '22' }, { 'nome': 'João', 'idade': '30' }, ])
def test_scenario_outline1_fr_from_string(): 'Language: FR -> Scenario.from_string, with scenario outline, first case' lang = Language('fr') scenario = Scenario.from_string(OUTLINED_SCENARIO, language=lang) assert_equals( scenario.name, 'Ajouter 2 nombres' ) assert_equals( scenario.outlines, [ {u'input_1':u'20',u'input_2':u'30',u'bouton':u'add',u'output':u'50'}, {u'input_1':u'2',u'input_2':u'5',u'bouton':u'add',u'output':u'7'}, {u'input_1':u'0',u'input_2':u'40',u'bouton':u'add',u'output':u'40'}, ] )
def test_scenario_ru_from_string(): 'Language: RU -> Scenario.from_string' ru = Language('ru') scenario = Scenario.from_string(SCENARIO, language=ru) assert_equals(scenario.name, 'Сохранение базы курсов универитета в текстовый файл') assert_equals(scenario.steps[0].hashes, [ { 'Название': 'Матан', 'Длительность': '2 года' }, { 'Название': 'Основы программирования', 'Длительность': '1 год' }, ])
def test_language_has_first_of(): "Language() can pick up first occurrece of a string" lang = Language() assert_equals(lang.first_of_examples, 'Examples')