def test_first(): tokenized = Tokenized() tokenized.add(Token(TokenType.SIMPLE, "simple")) first = tokenized.first() assert first.get_token_type() == TokenType.SIMPLE assert first.get_string_value() == "simple" tokenized.add(Token(TokenType.DOUBLE_QUOTED, "\"double\"")) assert first.get_token_type() == TokenType.SIMPLE assert first.get_string_value() == "simple"
def test_first_of_empty(): tokenized = Tokenized() with pytest.raises(Exception): tokenized.first()