예제 #1
0
 def test_set_backed_value_doesnt_modify_backing_store(self):
   bs = self.create_backing_store({
     "Iron Man": { "alignment": "good" }
   })
   iron_man = BackedObject(bs, "Iron Man")
   self.assertEqual(iron_man.backed_value("alignment"), "good")
   iron_man.set_backed_value("alignment", "questionable")
   self.assertEqual(iron_man.backed_value("alignment"), "questionable")
   self.assertEqual(bs.get("Iron Man", "alignment"), "good")
예제 #2
0
 def test_find_after_set_object_for_identifier_returns_same_object_that_was_set(
         self):
     war_machine = BackedObject(self.backing_store, "War Machine")
     self.manager.set_object_for_identifier(war_machine, "War Machine")
     self.assertEquals(self.manager.find("War Machine"), war_machine)
예제 #3
0
 def new(self, backing_store, identifier):
     return BackedObject(backing_store, identifier)
예제 #4
0
 def test_set_backed_value(self):
   bs = self.create_backing_store({ "Iron Man": {} })
   iron_man = BackedObject(bs, "Iron Man")
   self.assertIsNone(iron_man.backed_value("identity"))
   iron_man.set_backed_value("identity", "Tony Stark")
   self.assertEquals(iron_man.backed_value("identity"), "Tony Stark")