diff --git a/tests/test_tokenize.py b/tests/test_tokenize.py index 4543350..4a11642 100644 --- a/tests/test_tokenize.py +++ b/tests/test_tokenize.py @@ -48,19 +48,24 @@ assert (location1 == location2) == equals +# Draws a random token type +@composite +def draw_token_type(draw): + return draw(sampled_from(list(tokenize.TokenType))) + + # Draws a random token @composite def draw_token(draw): value = draw(text()) location = draw(draw_token_location()) - type = tokenize.TokenType.UNKNOWN + type = draw(draw_token_type()) return tokenize.Token(value, location, type) # Test token getters -@given(text(), draw_token_location()) -def test_tokenize_token_getters(value, location): - type = tokenize.TokenType.UNKNOWN +@given(text(), draw_token_location(), draw_token_type()) +def test_tokenize_token_getters(value, location, type): test = tokenize.Token(value, location, type) assert test.value == value assert test.location == location