Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 77f1866

Browse files
Vooblinafrozenator
authored andcommitted
Update test file (#1698)
1 parent c06cf3f commit 77f1866

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tensor2tensor/data_generators/wikisum/utils_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,24 @@
2424

2525
import tensorflow as tf
2626

27-
pkg_dir, _ = os.path.split(__file__)
27+
pkg_dir = os.path.abspath(__file__)
28+
pkg_dir, _ = os.path.split(pkg_dir)
2829
_TESTDATA = os.path.join(pkg_dir, "test_data")
2930

3031

3132
def _get_testdata(filename):
32-
with tf.gfile.Open(os.path.join(_TESTDATA, filename)) as f:
33+
with tf.io.gfile.GFile(filename) as f:
3334
return f.read()
3435

3536

3637
class UtilsTest(tf.test.TestCase):
3738

3839
def test_filter_paragraph(self):
39-
for bad in tf.gfile.Glob(os.path.join(_TESTDATA, "para_bad*.txt")):
40+
for bad in tf.io.gfile.glob(os.path.join(_TESTDATA, "para_bad*.txt")):
4041
for p in _get_testdata(bad).split("\n"):
4142
self.assertTrue(utils.filter_paragraph(p),
4243
msg="Didn't filter %s" % p)
43-
for good in tf.gfile.Glob(os.path.join(_TESTDATA, "para_good*.txt")):
44+
for good in tf.io.gfile.glob(os.path.join(_TESTDATA, "para_good*.txt")):
4445
for p in _get_testdata(good).split("\n"):
4546
p = _get_testdata(good)
4647
self.assertFalse(utils.filter_paragraph(p), msg="Filtered %s" % p)

0 commit comments

Comments
 (0)