CS50P PSET 5 Test_twttr - Check50 shows error code 1, pytest doesn't

2 weeks ago 13
ARTICLE AD BOX

When I run check50 to check my work for this problem (pset 5), it says that twttr.py does not pass all of the test checks. However, no errors pop up when running pytest myself. I am trying to figure out how to fix this and move on, but I can't figure out what the issue is. I've had previous issues with check50 in the past, but this one just does not let me check my work at all. Twttr.py and test_twttr.py are both in the same file, called test_twttr so I can use pytest. I also looked at a similar question to mine on here, but I couldn't solve my problem. Can anyone help me figure the problem out? Thanks.

Check50 response:

Results for cs50/problems/2022/python/tests/twttr generated by check50 v4.0.0.dev0 :) test_twttr.py exist :( correct twttr.py passes all test_twttr checks expected exit code 0, not 1 :| test_twttr catches twttr.py without vowel replacement can't check until a frown turns upside down :| test_twttr catches twttr.py without capitalized vowel replacement can't check until a frown turns upside down :| test_twttr catches twttr.py without lowercase vowel replacement can't check until a frown turns upside down :| test_twttr catches twttr.py omitting numbers can't check until a frown turns upside down :| test_twttr catches twttr.py printing in uppercase can't check until a frown turns upside down :| test_twttr catches twttr.py omitting punctuation can't check until a frown turns upside down To see more detailed results go to https://submit.cs50.io/check50/a3a769a45c4ba998a3cd418050a1fc0f6153b95d

This is my twttr.py code:

def main(): usin = input("Input: ") print (f"Output: {convert(usin)}") def convert(uword): vowels = ["a","A","e","E","i","I","o","O","u","U"] newword = "" for i in range(len(uword)): if uword[i] not in vowels: newword = (newword + uword[i]) return newword if __name__ == "__main__": main()

This is my test_twttr.py code:

import twttr def test_no_vowels(): assert twttr.convert("bcdfghjk") == "bcdfghjk" def test_lower_vowels(): assert twttr.convert("aeiouz") == "z" def test_upper_vowels(): assert twttr.convert("AEIOUz") == "z" def test_number(): assert twttr.convert("8abc") == "8bc" def test_uppercase(): assert twttr.convert("LALALAlalala") == "LLLlll" def test_punctuation(): assert twttr.convert("hello,!#*& world") == "hll,!#*& wrld"
Read Entire Article