def issuperset(self, other): if isinstance(other, type(self)): return self._delegate >= other._delegate if not superposition.insuperposition(other): return self.hasstate(superposition.getstate(other)) other_states = self._make_delegate() other_states.update(superposition.getstates(other)) return self._delegate >= other_states
def testCreation(self): """Test that creation is reasonable.""" # Providing the same object twice will still build a superposition. s = superposition.superposition("foo", "foo") # This object is a superposition type... self.assertIsInstance(s, superposition.ISuperposition) # ...but it is not IN superposition. self.assertFalse(superposition.insuperposition(s)) # Using meld is sometimes more convenient for this. s = superposition.meld("foo", "foo") # This object is actually a string. self.assertIsInstance(s, six.string_types) # It can still be manipulated with the superposition-aware protocol, # as can any scalar. self.assertEqual(s, superposition.getstate(s))
def testCreation(self): """Test that creation is reasonable.""" # Providing the same object twice will still build a superposition. s = superposition.superposition("foo", "foo") # This object is a superposition type... self.assertIsInstance(s, superposition.ISuperposition) # ...but it is not IN superposition. self.assertFalse(superposition.insuperposition(s)) # Using meld is sometimes more convenient for this. s = superposition.meld("foo", "foo") # This object is actually a string. self.assertIsInstance(s, basestring) # It can still be manipulated with the superposition-aware protocol, # as can any scalar. self.assertEqual(s, superposition.getstate(s))