While running the test for the parser I noticed that my testfunctions for the parser do not run:
import pytest
from exc48 import parser, lexicon
def sentence_test():
result = lexicon.scan("princess kills bear")
assert parser.Sentence(result) == "noun""verb""noun"
def peek_test():
assert peek([('noun', 'bear')]) == 'noun'
assert peek("wallstreet") == none
With this code I get the following:
At first, I thought that for some reason the parser_test wasn’t running. But to test that I put in some extra code:
import pytest
from exc48 import parser, lexicon
def sentence_test():
result = lexicon.scan("princess kills bear")
assert parser.Sentence(result) == "noun""verb""noun"
def peek_test():
assert peek([('noun', 'bear')]) == 'noun'
assert peek("wallstreet") == none
def test_test():
x = 1
y = 1
assert x == y
When I pytest this it does show that the file is running:
So the testfile is running but the tests I have made in the testfile are not. I could find a lot on youtube about how to make a testfile running but not about why I certain testfunction within a testfile would not run.
If the importing was not working or the input of the testfunction would be wrong then I would atleast expect an error.
On top of this. If I mess up the code by putting comma’s like this:
assert parser.Sentence(result) == "noun","verb","noun"
It will give me an error:
So it seems like it does run the testfunction. But if it does not have any mistakes inside of it, it doesn’t test anything.
Have been struggling with this for a while, any help would be appreciated.