def test_numerics(self): p = PositiveInteger(42) p2 = cybox.test.round_trip(p) self.assertEqual(p.to_dict(), p2.to_dict()) i = Integer(42) i2 = cybox.test.round_trip(i) self.assertEqual(i.to_dict(), i2.to_dict()) u = UnsignedLong(42) u2 = cybox.test.round_trip(u) self.assertEqual(u.to_dict(), u2.to_dict()) u3 = UnsignedLong("42") self.assertEqual(u3.value, 42) self.assertNotEqual(u3.value, "42") self.assertEqual(u3.to_dict(), u.to_dict())
def test_list_numerics(self): i = Integer([1, 2, 3]) i2 = Integer.from_dict({'value': ['1', '2', '3']}) self.assertEqual(i.to_dict(), i2.to_dict())