def test_coefficients(self): exp = AffVstack(self.x) coeffs = exp.coefficients(self.intf) self.assertEqual(coeffs.keys(), self.x.coefficients(self.intf).keys()) exp = AffVstack(self.x, self.y) coeffs = exp.coefficients(self.intf) self.assertItemsEqual(coeffs.keys(), self.x.coefficients(self.intf).keys() + \ self.y.coefficients(self.intf).keys()) for k,v in coeffs.items(): self.assertEqual(intf.size(v), (4,2)) exp = AffVstack(self.A, self.B, self.C) coeffs = exp.coefficients(self.intf) v = coeffs[self.A] self.assertEqual(intf.size(v), (10,3))
def test_variables(self): exp = AffVstack(self.x, self.y, self.x+self.y) self.assertItemsEqual(exp.variables(), [self.x, self.y, self.x, self.y]) exp = AffVstack(self.A, self.B, self.C) self.assertItemsEqual(exp.variables(), [self.A, self.B])