def test_compare_trace1(self): #test getLineageTrace() on an intermediate m = full((5, 10), 4.20) m_res = m * 3.1 m_sum = m_res.sum() with open(os.path.join("tests", "lt.txt"), "r") as file: data = file.read() file.close() self.assertEqual(reVars(m_res.getLineageTrace()), reVars(data))
def full(self, shape: Tuple[int, int], value: Union[float, int]) -> 'OperationNode': """Generates a matrix completely filled with a value :param shape: shape (rows and cols) of the matrix :param value: the value to fill all cells with :return: the OperationNode representing this operation """ return full(self, shape, value)
def test_compare_trace2(self): #test (lineage=True) as an argument to compute m = full((5, 10), 4.20) m_res = m * 3.1 sum, lt = m_res.sum().compute(lineage = True) lt = re.sub(r'\b_mVar\d*\b', '', lt) with open(os.path.join("tests", "lt2.txt"), "r") as file: data = file.read() file.close() self.assertEqual(reVars(lt), reVars(data))
def test_full(self): self.assertTrue(np.allclose(full((2, 3), 10.1).compute(), np.full((2, 3), 10.1)))