#๐ Testing plates
44 messages ยท Page 1 of 1 (latest)
@lunar parrot
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
first off, you should never, ever have to do == True or == False
for the former, just leave it out
for the latter, just add not
but can you clarify your question a bit?
wdym just have no True statment?
assert plates.is_valid("AAA222")
i didnt know i could do that until now thanks
im not sure how to pass my checks for my tests
its a course
should I already know how that function works or what it does?
u can have a read
where?
def is_valid(s):
if len(s) > 6 or len(s) < 2:
return False
if s[0].isnumeric() or s[1].isnumeric():
return False
count = 0
for char in s:
if char.isalnum() == False:
return False
if char.isnumeric() and count == 0 and char == "0":
return False
elif char.isnumeric():
count += 1
for c in s:
if c.isnumeric():
position = s.index(c)
if s[position: ].isnumeric() != True:
return False
return True
here
ok so are those two tests failing?
apologies if its not clear
no passes
but idk how to do the checks of my tests
heres a link for the question
if I understand the assignment correctly, you should have additional tests for failing cases
umm
im not sure what to do for that tho
have a read of this too, this is for the function is_valid()
๐ฆ test_plates catches plates.py without beginning alphabetical checks
what does the above mean? ^^
presumably it would test that this part is in place:
if s[0].isnumeric() or s[1].isnumeric():
return False
so the test should call the function with a plate that is of the correct length but starts with a digit
if I understand this correctly
um
yes
its just the checks that is not doing its job
frankly I also have trouble understanding just what this test module is expected to do
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.