def test_scale_by_float(self):
     poly = BinaryPolynomial({'a': 4}, 'SPIN')
     poly.scale(.25)
     self.assertEqual(poly['a'], 1)
 def test_typical(self):
     poly = BinaryPolynomial({'a': 1, 'ab': 1, '': 1}, 'BINARY')
     poly.scale(2)
     self.assertEqual(poly['a'], 2)
     self.assertEqual(poly['ba'], 2)
     self.assertEqual(poly[tuple()], 2)
 def test_ignore_terms(self):
     poly = BinaryPolynomial({'a': 1, 'ab': 1, '': 1}, 'BINARY')
     poly.scale(2, ignored_terms=['', 'ba'])
     self.assertEqual(poly['a'], 2)
     self.assertEqual(poly['ba'], 1)
     self.assertEqual(poly[tuple()], 1)
 def test_single_variable(self):
     poly = BinaryPolynomial({'a': -1}, 'SPIN')
     poly.scale(.5)
     self.assertEqual(poly['a'], -.5)