Unverified Commit 11bb3eec authored by Connor Baker's avatar Connor Baker Committed by GitHub
Browse files

python3Packages.tensorflow-datasets: fix tests (#502523)

parents 719acd5a cc88efc7
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -85,6 +85,25 @@ buildPythonPackage (finalAttrs: {
    })
  ];

  postPatch =
    # AttributeError: 'google._upb._message.FieldDescriptor' object has no attribute 'label'
    ''
      substituteInPlace tensorflow_datasets/core/dataset_info.py \
        --replace-fail \
          "elif field.label == field.LABEL_REPEATED:" \
          "elif hasattr(field_value, 'extend'):"
    ''
    # TypeError: only 0-dimensional arrays can be converted to Python scalars
    + ''
      substituteInPlace tensorflow_datasets/datasets/smallnorb/smallnorb_dataset_builder.py \
        --replace-fail \
          "magic = int(np.frombuffer(s, dtype=int32_dtype, count=1))" \
          "magic = int(np.squeeze(np.frombuffer(s, dtype=int32_dtype, count=1)))" \
        --replace-fail \
          "ndim = int(np.frombuffer(s, dtype=int32_dtype, count=1, offset=4))" \
          "ndim = int(np.squeeze(np.frombuffer(s, dtype=int32_dtype, count=1, offset=4)))"
    '';

  build-system = [ setuptools ];

  dependencies = [