Esempio n. 1
0
def test_1():
    array = []
    actual = repeated_word(
        "Python is an interpreted high-level general-purpose programming language ,PHP is a server scripting language and a powerful tool for making dynamic and interactive Web pages. , Java is a high-level class-based object-oriented programming language that is designed to have as few implementation dependencies as possible."
    )
    expected = 'is'
    assert actual == expected
def test_picks_first_repeated_word():
    expected = "a", 10
    actual = repeated_word("Once upon a time, there was a brave princess who")
    assert actual == expected
def test_counts_the_number_of_words():
    expected = "summer", 23
    actual = repeated_word(
        "It was a queer, sultry summer, the summer they electrocuted the Rosenbergs, and I didn’t know what I was doing in New York..."
    )
    assert actual == expected
def test_no_repeated_words():
    expected = "No repeating words ¯\_(ツ)_/¯", 4
    actual = repeated_word("Once upon a time")
    assert actual == expected
def test_empty_list():
    expected = "No repeating words ¯\_(ツ)_/¯", 0
    actual = repeated_word("")
    assert actual == expected
def test_repeated_word_exists():
    test = repeated_word()
    assert test == None
Esempio n. 7
0
def test_3():
    actual = repeated_word(
        "It was a queer, sultry summer , the summer they electrocuted the Rosenbergs, and I didn’t know what I was doing in New York..."
    )
    expected = 'summer'
    assert actual == expected
def test_repeated_word():
    actual = repeated_word('In good time in bad time friends are friends')
    expected = 'time'
    assert actual == expected
Esempio n. 9
0
def test_2():
    actual = repeated_word(
        "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way – in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only..."
    )
    expected = 'it'
    assert actual == expected
Esempio n. 10
0
def test_works_with_short_string():
    string = 'This string repeats the word string'
    assert repeated_word(string) == 'string'
Esempio n. 11
0
def test_works_with_single_word_string():
    string = 'The'
    assert repeated_word(string) is False
Esempio n. 12
0
def test_works_with_empty_string():
    string = ''
    assert repeated_word(string) is False
Esempio n. 13
0
def test_works_with_longer_string():
    string = 'This is a slightly longer string that will eventually have a repeat'
    assert repeated_word(string) == 'a'
Esempio n. 14
0
def test_string1():
    word = "Once upon a time, there was a brave princess who..."
    actual = repeated_word(word)
    expected = 'a'
    assert actual == expected