Пример #1
0
 def test_set_key(self):
     exp = ((0, 3), (5, 2))
     m = MVPolyDictMonomial()
     m.key = exp
     obt = m.key
     self.assertTrue(obt == exp,
                     "bad constructor:\n{0!s}".format(repr(obt)))
Пример #2
0
 def test_set_dict(self):
     exp = {0:3, 5:2}
     m = MVPolyDictMonomial()
     m.dict = exp
     obt = m.dict
     self.assertTrue(obt == exp,
                     "bad constructor:\n{0!s}".format(repr(obt)))
Пример #3
0
 def test_get_index(self):
     for idx in [ (3, 0, 0, 1), (1,), () ]:
         m = MVPolyDictMonomial()
         m.index = idx
         self.assertTrue(m.index == idx,
                         "bad index:\n{0!s}".format(repr(m.index)))
     m = MVPolyDictMonomial(index = (3, 3, 0, 0))
     self.assertTrue(m.index == (3, 3),
                     "bad index:\n{0!s}".format(repr(m.index)))
Пример #4
0
 def test_nonzero_mononomial(self):
     m = MVPolyDictMonomial(dict = {0:3, 3:1})
     obt = m.dict
     self.assertTrue(obt == {0:3, 3:1},
                     "zero poly bad dict:\n{0!s}".format(repr(obt)))
     obt = m.key
     self.assertTrue(obt == ((0, 3), (3, 1)),
                     "zero poly bad key:\n{0!s}".format(repr(obt)))
     obt = m.index_of_length(4)
     self.assertTrue(obt == (3, 0, 0, 1),
                     "zero poly bad idx:\n{0!s}".format(repr(obt)))
Пример #5
0
 def test_zero_mononomial(self):
     m = MVPolyDictMonomial(dict = {})
     obt = m.dict
     self.assertTrue(obt == {},
                     "zero poly bad dict:\n{0!s}".format(repr(obt)))
     obt = m.key
     self.assertTrue(obt == (),
                     "zero poly bad key:\n{0!s}".format(repr(obt)))
     obt = m.index_of_length(4)
     self.assertTrue(obt == (0, 0, 0, 0),
                     "zero poly bad idx:\n{0!s}".format(repr(obt)))
Пример #6
0
 def test_set_index(self):
     exp = (3, 0, 0, 0, 0, 2)
     m = MVPolyDictMonomial()
     m.index = exp
     obt = m.index_of_length(6)
     self.assertTrue(obt == exp, "bad index:\n{0!s}".format(repr(obt)))
Пример #7
0
 def test_construct_from_index(self):
     exp = (3, 0, 1, 0)
     m = MVPolyDictMonomial(index = exp)
     obt = m.index_of_length(4)
     self.assertTrue(obt == exp,
                     "bad constructor:\n{0!s}".format(repr(obt)))