def test_unmarshal_val_not_in_choices_gives_sam_val(self):
     # TODO: Test that logging is done as well
     c = ChoicesAttribute(unicode, (SUMMARY, ),
                          choices={
                              1: "one",
                              2: "two"
                          })
     self.assertEqual(c.unmarshal(0), 0)
     self.assertEqual(c.unmarshal(None), None)
 def test_unmarshal_data(self):
     c = ChoicesAttribute(unicode, (SUMMARY, ),
                          choices={
                              1: "one",
                              2: "two"
                          })
     self.assertEqual(c.unmarshal(2), "two")
     self.assertEqual(c.unmarshal(1), "one")
示例#3
0
 def test_unmarshal_val_not_in_choices_gives_sam_val(self):
     # TODO: Test that logging is done as well
     c = ChoicesAttribute(unicode, (SUMMARY, ), choices={1: "one", 2: "two"})
     self.assertEqual(c.unmarshal(0), 0)
     self.assertEqual(c.unmarshal(None), None)
示例#4
0
 def test_unmarshal_data(self):
     c = ChoicesAttribute(unicode, (SUMMARY, ), choices={1: "one", 2: "two"})
     self.assertEqual(c.unmarshal(2), "two")
     self.assertEqual(c.unmarshal(1), "one")