Merge pull request #41273 from lgeiger:fix-python35-test

PiperOrigin-RevId: 320624065
Change-Id: I4a95af39549380a4c7ff6cb861a197f44c9e34a5
This commit is contained in:
TensorFlower Gardener 2020-07-10 10:16:03 -07:00
commit b5a50ac950

View File

@ -20,7 +20,6 @@ from __future__ import division
from __future__ import print_function
import os.path
import pathlib
from absl.testing import parameterized
import numpy as np
@ -31,9 +30,19 @@ from tensorflow.python.platform import gfile
from tensorflow.python.platform import test
class PathLike(object):
"""Backport of pathlib.Path for Python < 3.6"""
def __init__(self, name):
self.name = name
def __fspath__(self):
return self.name
run_all_path_types = parameterized.named_parameters(
("str", os.path.join),
("pathlib", lambda *paths: pathlib.Path(os.path.join(*paths))))
("pathlike", lambda *paths: PathLike(os.path.join(*paths))))
class FileIoTest(test.TestCase, parameterized.TestCase):