def test_no_returns_not_no(self): actual = not_string("no") expected = "not no" self.assertEqual( actual, expected, 'Expected calling not_string() with "no" to return "not no"' )
def test_candy_returns_not_candy(self): actual = not_string("candy") expected = "not candy" self.assertEqual( actual, expected, 'Expected calling not_string() with "candy" to return "not candy"' )
def test_bad_returns_not_bad(self): actual = not_string("bad") expected = "not bad" self.assertEqual( actual, expected, 'Expected calling not_string() with "bad" to return "not bad"' )
def test_is_not_returns_not_is_not(self): actual = not_string("is not") expected = "not is not" self.assertEqual( actual, expected, 'Expected calling not_string() with "is not" to return "not is not"' )
def test_already_starts_with_not(): assert not_string('not candy') == 'not candy'
def test_x_returns_not_x(self): actual = not_string("x") expected = "not x" self.assertEqual( actual, expected, 'Expected calling not_string() with "x" to return "not x"' )
from not_string import not_string import pytest """Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged. not_string('candy') → 'not candy' not_string('x') → 'not x' not_string('not bad') → 'not bad' """ def test_not_added_to_beginning(): assert not_string('candy') == 'not candy' def test_already_starts_with_not(): assert not_string('not candy') == 'not candy'
def test_not_added_to_beginning(): assert not_string('candy') == 'not candy'
def test_4(): assert not_string("not handy candy") == "not handy candy"
def test_3(): assert not_string("Does not get prepended?") == \ "not Does not get prepended?"
def test_2(): assert not_string("not does not need 'not' prepended") == \ "not does not need 'not' prepended"
def test_1(): assert not_string("This is not candy") == "not This is not candy"
# -*- coding: utf-8 -*- """ Created on Sat Apr 28 10:01:16 2018 @author: Karl M. Snyder """ """Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged. not_string('candy') → 'not candy' not_string('x') → 'not x' not_string('not bad') → 'not bad' """ # import definition from not_string import not_string def test_1(): assert not_string("This is not candy") == "not This is not candy" def test_2(): assert not_string("not does not need 'not' prepended") == \ "not does not need 'not' prepended" def test_3(): assert not_string("Does not get prepended?") == \ "not Does not get prepended?"