<commit_before># third party
import numpy as np
import pytest

# syft absolute
import syft as sy
from syft.core.adp.data_subject_list import DataSubjectArray

# from syft.core.tensor.autodp.gamma_tensor import GammaTensor
from syft.core.tensor.autodp.phi_tensor import PhiTensor as PT
from syft.core.tensor.lazy_repeat_array import lazyrepeatarray as lra
from syft.core.tensor.tensor import Tensor


@pytest.fixture
def high() -> int:
    return 10


@pytest.fixture
def low() -> int:
    return 0


@pytest.fixture
def data(high: int, low: int) -> np.ndarray:
    return np.random.randint(low=low, high=high, size=(5, 5))


@pytest.fixture
def tensor(data: np.ndarray) -> Tensor:
    return sy.Tensor(data)


def test_string(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects="Optimus Prime")
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, DataSubjectArray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_list(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects=["Optimus Prime"])
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, DataSubjectArray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_tuple(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects=("Optimus Prime"))
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, DataSubjectArray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_array(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(
        min_val=low, max_val=high, data_subjects=np.array(["Optimus Prime"])
    )
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, DataSubjectArray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1<commit_msg>Saving progress on fixing failing tests<commit_after># third party
import numpy as np
import pytest

# syft absolute
import syft as sy

# from syft.core.tensor.autodp.gamma_tensor import GammaTensor
from syft.core.tensor.autodp.phi_tensor import PhiTensor as PT
from syft.core.tensor.lazy_repeat_array import lazyrepeatarray as lra
from syft.core.tensor.tensor import Tensor


@pytest.fixture
def high() -> int:
    return 10


@pytest.fixture
def low() -> int:
    return 0


@pytest.fixture
def data(high: int, low: int) -> np.ndarray:
    return np.random.randint(low=low, high=high, size=(5, 5))


@pytest.fixture
def tensor(data: np.ndarray) -> Tensor:
    return sy.Tensor(data)


def test_string(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects="Optimus Prime")
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, np.ndarray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_list(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects=["Optimus Prime"])
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, np.ndarray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_tuple(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(min_val=low, max_val=high, data_subjects=("Optimus Prime"))
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, np.ndarray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1


def test_array(tensor: Tensor, low: int, high: int) -> None:
    private = tensor.private(
        min_val=low, max_val=high, data_subjects=np.array(["Optimus Prime"])
    )
    assert isinstance(private, Tensor)
    assert isinstance(private.child, PT)
    assert isinstance(private.child.min_vals, lra)
    assert isinstance(private.child.max_vals, lra)
    assert private.child.min_vals.shape == private.child.shape
    assert private.child.max_vals.shape == private.child.shape
    assert isinstance(private.child.data_subjects, np.ndarray)
    assert private.child.data_subjects.shape == private.child.shape
    assert len(private.child.data_subjects.sum()) == 1
{'fraction_non_alphanumeric': 0.11251694532309083, 'fraction_numerical': 0.0027112516945323093, 'mean_word_length': 4.465020576131687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6099082', 'n_tokens_mistral': 2104, 'n_tokens_neox': 2071, 'n_words': 462}