[Python] Unit testing for code isn't working for cs50 problem

Discussão em 'Python' iniciado por Stack, Agosto 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently working on a Cs50 problem called Testing my Twitter. The code works very well and has no problems. But I'm having trouble trying to run a unit test on it.

    this is my regular code that needs testing:

    def shorten(word):
    tweet = input("Input: ")
    for letter in tweet:
    if not letter in ['A','E','I','O','U','a','e','i','o']:
    return letter
    print()


    And this is my unit test code:

    import twttr

    def test_twttr():
    assert shorten('Hello') == 'Hll'
    test_twttr()


    I've run into a lot of errors and have reached this point in my code where it just says OK. I changed my code to have an error and I'm still getting the same message. Can someone please take a look and see what's going on?

    Continue reading...

Compartilhe esta Página