tensorflow/python/ops/structured/structured_tensor_test.py
File structured_tensor_test.py
has 1644 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
StructuredTensorTest
has 44 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class StructuredTensorTest(test_util.TensorFlowTestCase,
parameterized.TestCase):
def assertAllEqual(self, a, b, msg=None):
if not (isinstance(a, structured_tensor.StructuredTensor) or
Function testWithUpdatesDelete
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def testWithUpdatesDelete(self):
pyval = {"a": 12, "b": {"c": 23, "d": {"e": 11}}}
st = StructuredTensor.from_pyval(pyval)
updated_st = st.with_updates({("b", "c"): None}, validate=True)
self.assertNotIn("c", updated_st.field_value("b").field_names())
Function testFromFieldsErrors
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def testFromFieldsErrors(self,
Function testFromFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def testFromFields(self,
shape,
fields,
expected_shape=None,
nrows=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function testFromFields
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def testFromFields(self,
Function testFromFieldsErrors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def testFromFieldsErrors(self,
fields,
shape,
nrows=None,
row_partitions=None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"