def test_shortcut_dict_representation(self): """If precision is the default value, to_dict should return a string""" date_str = "2013-11-17" d = DateWithPrecision() d.precision = "day" d.value = date_str self.assertEqual(str, type(d.to_dict())) self.assertEqual(date, type(d.value)) self.assertEqual(date_str, d.to_dict()) d2 = cybox.test.round_trip(d, output=True) self.assertEqual(d.to_dict(), d2.to_dict())
def test_construction(self): d = DateWithPrecision() d.precision = "month" d.value = "2014-01-01" self.assertEqual(self._full_dict, d.to_dict())