def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    assert multi_find("xxxatcgxxxatcgxxatcg","atcg",2,20) == "3,10,16"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0 , 4 , 8 , 12 ,"
    assert multi_find("Hello, are you my mummy?", "my", 0, 23) == "15 , 21 ,"
    assert multi_find("This is a sentence", "notinsentence", 0, 18) == " , "
    assert multi_find("Wibbley wobbly timey wimey stuff", "ey", 0, 32) == "6 , 19 , 25 ,"
Example #3
0
def test_multi_find_basic():
    """
	Test multi_find function.
	"""
    #tests whether or not our code actually works
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("Ni! Ni! NI! nI!", "ni", 0, 20) == "0,4,8,12"
    assert multi_find("Well, I didn't vote for you.", "Concord", 0, 30) == ""
def test_multi_find_basic():
    """
    Test multi_find function: find multi index of "Ni" in the string with the start of 0 and end of 20.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 100, 200) == ""
    assert multi_find("How are you today", "Ni", 0, 100) == ""
    assert multi_find("How are you today", "o", 0, 20) == "1,9,13"
def test_multi_find_basic_not_present():
    """
    Test multi_find function when substring is not present in input_string, or outside index range.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "ni", 0, 15) == ""
    assert multi_find("Who lives in a pineapple under the sea", "spongebob", 0, 38) == ""
    assert multi_find("Who lives in a pineapple under the sea", "sea", 0, 30) == ""
    assert multi_find("", "ni", 0, 0) == ""
def test_multi_find_nothing():
    assert multi_find("Ni! Ni! Ni! Ni!", "Hi", 0, 20) == "No Match Found"

    # Test using integers
    multi_find(4112341156411, 411, 0, 13) == "0,5,10"

    # Test using special characters
    multi_find("!@#$ $#@! ^%$! !@*(", "!", 0, 18) == "0,8,13,15"
def test_multi_find_overlap():
    """
    Test multi_find function.
    """
    assert multi_find("lololololol", "lol", 0, 11) == "0,2,4,6,8"
    assert multi_find("lololololol", "lol", 3, 10) == "4,6"
    assert multi_find("aaaaa", "aa", 0, 5) == "0,1,2,3"
    assert multi_find("aaaaa", "aaa", 0, 5) == "0,1,2"
    assert multi_find("aaaaa", "aaa", 1, 5) == "1,2"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    assert multi_find("Fa la la la la, la la la la", "a", 0, 20) == "1,4,7,10,13,17"

    assert multi_find("Do Re Mi Fa Sol La Ti", "deer", 0, 20) == "-1"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0 , 4 , 8 , 12 ,"
    assert multi_find("Hello, are you my mummy?", "my", 0, 23) == "15 , 21 ,"
    assert multi_find("This is a sentence", "notinsentence", 0, 18) == " , "
    assert multi_find("Wibbley wobbly timey wimey stuff", "ey", 0,
                      32) == "6 , 19 , 25 ,"
def test_multi_find_more():
    """
    Establish other function to test more scenarios of find_multi
    """

    assert multi_find("Ni! Ni! Ni! Ni!", "Ni!", 2, 19) == "4,8,12"
    assert multi_find("Ni! nI! ni! NI!", "Ni!", 0, 15) == "0,4,8,12"
    assert multi_find("Ni!!!!! Ni! Ni! Ni!", "Ni", 0, -1) == ""
    assert multi_find("Ni ! Ni! Ni! Ni!!", "Ni", 9, -9) == ""
    assert multi_find("Ni!  N!! Ni!Ni!", "Ni", 0, 15) == "0,9,12"
def test_multi_find_invalid_substring():

    #Test if the substring is not in the input_string.

    assert multi_find("Ni! Ni! Ni! Ni!", "Ha", 0, 15) == ""

    assert multi_find("Halloween", "kee", 0, 9) == ""

    assert multi_find("Toronto_Pearson_Airport", "go", 0, 31) == ""

    assert multi_find("loading_message", "lol", 0, 15) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    # Test Cases added to check other correct and incorrect input/output
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0, 4, 8, 12"
    assert multi_find("HI HI HI HI", "HI", 0, 12) == "0, 3, 6, 9"
    assert multi_find("door door droo door dro", "door", 0, 20) == "0, 5, 15"
    # Test case shows when substring not found, -1 returned
    assert multi_find("Helololololololo", "Ni", 0, 20) == -1
    assert multi_find("warm warm warm", "cold", 0, 20) == -1
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == [0, 4, 8, 12]
    assert multi_find("ABCDEFFGABCDEFF", "FF", 3, 15) == [5, 13]
    assert multi_find("Ni! Ni! Ni! Ni!", "No", 0, 20) == ""

    try:
        multi_find(12382938293, "asldasd", 0, 15)
    except TypeError:
        assert True
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("Ni! Ni! Ni! Ni!", "i", 0, 20) == "1,5,9,13"
    assert multi_find("Ni! Ni! Ni! Ni!", "No", 0, 20) == ""
    assert multi_find("I'm a lumberjack and I'm OK. I'm a lumberjack and I'm OK.", "OK", 0, 57) == "25,54"
    assert multi_find("I'm a lumberjack and I'm OK. I'm a lumberjack and I'm OK.", "lumber", 0, 57) == "6,35"
    assert multi_find("I'm a lumberjack and I'm OK. I'm a lumberjack and I'm OK.", "parrot", 0, 57) == ""
    assert multi_find("It's just a flesh wound", "s", 0, 22) == "3,7,15"
    assert multi_find("It's just a flesh wound", "flesh", 0, 22) == "12"
    assert multi_find("It's just a flesh wound", "knight", 0, 22) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    # If the substring is not found it returns an empty string.
    assert multi_find("Ni! Ni! Ni! Ni!", "do", 0, 20) == ""

    # Test case for finding  the position of blank spaces.
    assert multi_find("Ni! Ni! Ni! Ni!", " ", 0, 20) == "3,7,11"

    # Test case to find special characters  in the main string .
    assert multi_find( "Ni! Ni! Ni! Ni!", "!", 0, 20) == "2,6,10,14"

    # Test case to find mutiple words.
    assert multi_find( "HAHAHA! That was so funny", "was so funny", 0, 25) == "13"
Example #16
0
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    # Positive Cases
    # Basic string with multiple sub-strings
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    # DNA sequence matching, there are 3 ACTG sub-strings
    assert multi_find("TCGAACTGACTGTCGAACTG", "ACTG", 0, 20) == "4,8,16"

    # Numbers
    assert multi_find("01234567890123456789", "456", 0, 20) == "4,14"

    # Returns all sub-string instances
    long_string = "This is the first ACTG string. This ACTG string should be returned."
    assert multi_find(long_string, "ACTG", 0, 66) == "18,36"

    # Errors
    # Returns "" when no sub-strings found
    assert multi_find(pangram, "cat", 0, 44) == ""

    # Empty entry
    assert multi_find("", "cat", 0, 0) == ""

    # 'start' param beyond first index occurrence leads to failure
    assert multi_find(pangram, "quick", 20, 71) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    # Positive Cases
    # Basic string with multiple sub-strings
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    # DNA sequence matching, there are 3 ACTG sub-strings
    assert multi_find("TCGAACTGACTGTCGAACTG", "ACTG", 0, 20) == "4,8,16"

    # Numbers
    assert multi_find("01234567890123456789", "456", 0, 20) == "4,14"

    # Returns all sub-string instances
    long_string = "This is the first ACTG string. This ACTG string should be returned."
    assert multi_find(long_string, "ACTG", 0, 66) == "18,36"


    # Errors
    # Returns "" when no sub-strings found
    assert multi_find(pangram, "cat", 0, 44) == ""

    # Empty entry
    assert multi_find("", "cat", 0, 0) == ""

    # 'start' param beyond first index occurrence leads to failure
    assert multi_find(pangram, "quick", 20, 71) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"

    # test substring multi search
    assert multi_find("Testing a string", "g", 0, 15) == "6,15"

    # test with substring not found
    assert multi_find("Testing a string again", "x", 0, 20) == ""

    # test for punctuation character as string
    # in string with different characters
    assert multi_find("abc123$!@ abc123$!@ abc123$!@", "!", 0, 30) == "7,17,27"

    # test for a whitespace (single space) search in string
    assert multi_find("Testing a string once more", " ", 0, 25) == "7,9,16,21"
def test_advanced_multi_find_basic():
    """
    Test the multi find function with many different situation
    """

    assert multi_find("ccaccacca", "c", 0, 9) == "0,1,3,4,6,7"

    # Test when the ending slice is out of range

    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 35) == "0,4,8,12"

    # Test when the substring is identical as input_string

    assert multi_find("book", "book", 0, 3) == "0"

    #Test when only ranging the first portion of the input_string

    assert multi_find("winterwinterwinter", "ter", 0, 5) == "3"

    #Test when only ranging from the last portion of the input_string

    assert multi_find("winterwinterwinter", "ter", 12, 17) == "15"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 15) == "0,4,8,12"
    assert multi_find("Catdogcatdog", "cat", 0, 12) == "6"
    assert multi_find("Catdogcatdog", "Cat", 0, 12) == "0"
    assert multi_find("Catdogcatdog", "dog", 0, 12) == "3,9"
    assert multi_find("aaaaa", "a", 0, 5) == "0,1,2,3,4"
    assert multi_find("aaaaa", "aaaaa", 0, 5) == "0"
    assert multi_find("aaaaa", "aaa", 1, 4) == "1"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("How do you do", "do", 0, 20) == "4,11"
    assert multi_find("456bfd8imbfd2", "fd", 0, 20) == "4,10"
    assert multi_find("Nice to meet you!", "o", 0, 20) == "6,14"
    assert multi_find("Nice to meet you!", "o", 20, 30) == ""
    assert multi_find("where are you going?", "457", 0, 30) == ""
Example #22
0
def test_multi_find_additional():
    """
    Test multi_find function with a variety of arguments.
    """
    # Test with numbers.
    assert multi_find("012345678989", "89", 0, 12) == "8,10"

    # Test with letters.
    assert multi_find("Jennifer", "n", 0, 7) == "2,3"

    # Test with string having multiple instances of substring.
    assert multi_find("DuckDuckDuckGoose", "Duck", 0, 16) == "0,4,8"

    # Test with string having no instances of substring.
    assert multi_find("Joe", "Z", 0, 2) == ""

    # Test with string having instances of substring outside of passed index range.
    assert multi_find("012345555555", "5", 0, 4) == ""

    # Test with index beyond the length of the string.
    assert multi_find("01234555", "5", 0, 44) == "5,6,7"
def test_multi_find_additional():
    """
    Test multi_find function with a variety of arguments.
    """
    # Test with numbers.
    assert multi_find("012345678989", "89", 0, 12) == "8,10"

    # Test with letters.
    assert multi_find("Jennifer", "n", 0, 7) == "2,3"

    # Test with string having multiple instances of substring.
    assert multi_find("DuckDuckDuckGoose", "Duck", 0, 16) == "0,4,8"

    # Test with string having no instances of substring.
    assert multi_find("Joe", "Z", 0, 2) == ""

    # Test with string having instances of substring outside of passed index range.
    assert multi_find("012345555555", "5", 0, 4) == ""

    # Test with index beyond the length of the string.
    assert multi_find("01234555", "5", 0, 44) == "5,6,7"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 15) == "0,4,8,12"
def test_num_string():

    # Test if the substring will return a string integer.

    assert multi_find("Address: 22 Street, Apt. 412, Area Code(212)", "2", 0,
                      44) == "9,10,27,40,42"
def test_not_in_multifind_scope():
    assert multi_find(THEME_SONG, "weird", 0, 5) == ""
    assert multi_find(THEME_SONG, "dimension", 0, 16) == ""
    assert multi_find("We say Ni! We say Ni! We say Ni! We say Ni! We say Ni!", "Ni!", 0, 7) == ""
def test_not_found_multi_find():
    assert multi_find(THEME_SONG, "Star Butterfly", 0, 337) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("Curly, Larry, Larry, Larry, Mo", "Larry", 0, 30) == "7,14,21"
def test_find_substring_larger_than_input_string():
    """
    Test multi_find function with an empty substring.
    """
    assert multi_find("parrot", "", 0, 0) == ""
    assert multi_find("", "", 0, 0) == ""
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
def test_multi_find_basic_2():
    """
    Test multi_find function when substring[s] are not found.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "ii", 0, 20) == "0"
def test_multi_find_basic():
    """
    Test multi_find function.
    """
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni", 0, 20) == "0,4,8,12"
    assert multi_find("Ni! No! No! Ni!", "Ni", 0, 20) == "0,12"
    assert multi_find("Ni! Ni! Ni! No!", "Ni", 0, 20) == "0,4,8"
    assert multi_find("Ni! Ni! Ni! Ni!", "Hi", 0, 20) == ""
    assert multi_find("12! Ni! Ni! 12!", "12", 0, 20) == "0,12"
    assert multi_find("Ni! Ni! Ni! Ni!", "NI", 0, 20) == ""
    assert multi_find("Ni! Ni! Ni! Ni!", "ni", 0, 20) == ""
    assert multi_find("ATCGGGGTGCGCGGGGAT", "GGGG", 0, 23) == "3,12"
    assert multi_find("ATCGGGGTGCGCGGGGAT", "GGGG", 6, 23) == "12"
    assert multi_find("ATCGGGGTGCGCGGGGAT", "GGGG", 0, 13) == "3"
    assert multi_find("ATCGGGGTGCGCGGGGAT", "GGGG", 6, 13) == ""
    assert multi_find("ATCGGGGTGCGCGGG", "GGGG", 0, 23) == "3"
def test_multi_find_advanced():
    """
    Test multi_find error function.
    """
    multi_find("Jacob says two two", "too", 0, 20)
    return -1
def test_multi_find_normal():
    assert multi_find(THEME_SONG, "weird", 0, 337) == "24,120,259"
    assert multi_find(THEME_SONG, "wild", 0, 337) == "48,283"
def test_multi_find_substring_larger_than_input_string():
    """
    Test multi_find function with a substring length larger than the input string length.
    """
    assert multi_find("parrot", "This is an ex-parrot", 0, 6) == ""
    assert multi_find("", "parrot", 0, 0) == ""
def test_multi_find_added():
    """
    Test multi_find function.
    """
    # =============  substring is found ==================================================

    # end index provided is out of range
    assert multi_find("Ni! Ni! Ni! Ni!", "Ni!", 1, 25) == "4,8,12"
    assert multi_find("Happy annnnn", "nn", 0, 25) == "7,8,9,10"

    # case sensitive
    assert multi_find("NI! NI! NI! Ni!", "Ni!", 0, 15) == "12"
    assert multi_find("Happy anNnnn", "nn", 0, 11) == "9"

    # end or start contain negative numbers, slicing notation does not give empty result
    assert multi_find("Ni! Ni! Ni! Ni!!", "Ni", 0, -1) == "0,4,8,12"
    assert multi_find("Ni! Ni! Ni! Ni!!", "Ni", -16, -1) == "0,4,8,12"
    assert multi_find("Happy annnnn.", "nn", 0, -1) == "7,8,9,10"
    assert multi_find("Happy annnnn", "n", -4, -3) == "8"

    # ============  substring is not found ==============================================

    # slicing notation gives empty result.
    assert multi_find("Ni! Ni! Ni! Ni!!", "Ni", 9, -7) == ""
    assert multi_find("Ni! Ni! Ni! Ni!!", "Ni", 0, 1) == ""
    assert multi_find("Happy annnnn", "nn", -7, 5) == ""
    assert multi_find("Happy annnnn", "n", -3, -4) == ""

    # (end - start) is less than the length of substring; Substring not in input_string[start:end].
    assert multi_find("Ni! Ni! Ni! Ni!!", "Ni!", 0, 2) == ""
    assert multi_find("Happy annnnn", "nnn", 7, 9) == ""

    # word is separated by other notations; word is not wholly found.
    assert multi_find("N!i N!i N!i N!i!", "Ni", 0, 15) == ""
    assert multi_find("Happy anniversary Happy anniversary", "ann!", 0, 38) == ""