Use Python 3.9 syntax in tests (#37343)
Signed-off-by: cyy <cyyever@outlook.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# coding=utf-8
|
||||
# Copyright 2021 The HuggingFace Inc. team.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -20,7 +19,6 @@ import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from functools import lru_cache
|
||||
from typing import Tuple
|
||||
|
||||
from transformers import AddedToken, BatchEncoding, PerceiverTokenizer
|
||||
from transformers.utils import cached_property, is_tf_available, is_torch_available
|
||||
@@ -58,7 +56,7 @@ class PerceiverTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
pretrained_name = pretrained_name or cls.tmpdirname
|
||||
return cls.tokenizer_class.from_pretrained(pretrained_name, **kwargs)
|
||||
|
||||
def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_length=20, min_length=5) -> Tuple[str, list]:
|
||||
def get_clean_sequence(self, tokenizer, with_prefix_space=False, max_length=20, min_length=5) -> tuple[str, list]:
|
||||
# XXX The default common tokenizer tests assume that every ID is decodable on its own.
|
||||
# This assumption is invalid for Perceiver because single bytes might not be
|
||||
# valid utf-8 (byte 128 for instance).
|
||||
|
||||
Reference in New Issue
Block a user