Skip to content

Commit 2d48b32

Browse files
committed
(wip) utils test
1 parent 055ce14 commit 2d48b32

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/tests/graph/test_utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
TestCase = namedtuple('TestCase', ['data', 'description'])
2828

2929

30-
def _gen_graph_elems_names():
30+
def _gen_tensor_op_string_input_tests():
3131
op_name = 'someOp'
3232
for tnsr_idx in range(17):
3333
tnsr_name = '{}:{}'.format(op_name, tnsr_idx)
@@ -37,12 +37,12 @@ def _gen_graph_elems_names():
3737
description='must get the tensor name from its operation')
3838

3939

40-
def _gen_wrong_graph_elems_types():
40+
def _gen_invalid_tensor_op_input_with_wrong_types():
4141
for wrong_val in [7, 1.2, tf.Graph()]:
4242
yield TestCase(data=wrong_val, description='wrong type {}'.format(type(wrong_val)))
4343

4444

45-
def _gen_graph_elems():
45+
def _gen_valid_tensor_op_objects():
4646
op_name = 'someConstOp'
4747
tnsr_name = '{}:0'.format(op_name)
4848
tnsr = tf.constant(1427.08, name=op_name)
@@ -67,25 +67,25 @@ def _gen_graph_elems():
6767

6868

6969
class TFeXtensionGraphUtilsTest(PythonUnitTestCase):
70-
@parameterized.expand(_gen_graph_elems_names)
70+
@parameterized.expand(_gen_tensor_op_string_input_tests)
7171
def test_valid_graph_element_names(self, data, description):
7272
""" Must get correct names from valid graph element names """
7373
name_a, name_b = data
7474
self.assertEqual(name_a, name_b, msg=description)
7575

76-
@parameterized.expand(_gen_wrong_graph_elems_types)
77-
def test_wrong_op_types(self, data, description):
76+
@parameterized.expand(_gen_invalid_tensor_op_input_with_wrong_types)
77+
def test_wrong_tensor_types(self, data, description):
7878
""" Must fail when provided wrong types """
7979
with self.assertRaises(TypeError):
80-
tfx.op_name(data, msg=description)
80+
tfx.tensor_name(data, msg=description)
8181

82-
@parameterized.expand(_gen_wrong_graph_elems_types)
82+
@parameterized.expand(_gen_invalid_tensor_op_input_with_wrong_types)
8383
def test_wrong_op_types(self, data, description):
8484
""" Must fail when provided wrong types """
8585
with self.assertRaises(TypeError):
8686
tfx.op_name(data, msg=description)
8787

88-
@parameterized.expand(_gen_graph_elems)
88+
@parameterized.expand(_gen_valid_tensor_op_objects)
8989
def test_get_graph_elements(self, data, description):
9090
""" Must get correct graph elements from valid graph elements or their names """
9191
tfobj_or_name_a, tfobj_or_name_b = data

0 commit comments

Comments
 (0)