@@ -0,0 +1,1644 @@
+import unittest%0A%0Afrom cybox.common.attributes import Attribute, String, Integer%0Afrom cybox.test import round_trip%0A%0Aclass TestAttribute(unittest.TestCase):%0A%0A    def test_plain(self):%0A        a = Attribute(%22test_value%22)%0A        self.assertTrue(a.is_plain())%0A%0A    def test_string(self):%0A        s = String(%22test_string%22)%0A        self.assertTrue(s.datatype, %22String%22)%0A        self.assertTrue(s.value, %22test_string%22)%0A%0A    def test_integer(self):%0A        i = Integer(42)%0A        self.assertTrue(i.datatype, %22Integer%22)%0A        self.assertTrue(i.value, 42)%0A%0A    def test_cannot_create_abstract_obj(self):%0A        a = Attribute()%0A        with self.assertRaises(NotImplementedError):%0A            a.to_obj()%0A%0A    def test_round_trip(self):%0A        s = String()%0A%0A        s.value = %22test_value%22%0A        s.id_ = %22test_a%22%0A        s.idref = %22test_b%22%0A        s.datatype = %22test_c%22%0A        s.condition = %22test_d%22%0A        s.pattern_type = %22test_e%22%0A        s.regex_syntax = %22test_f%22%0A        s.start_range = %22test_g%22%0A        s.end_range = %22test_h%22%0A        s.value_set = %22test_i%22%0A        s.has_changed = %22test_j%22%0A        s.trend = %22test_k%22%0A        s.appears_random = %22test_l%22%0A        s.is_obfuscated = %22test_m%22%0A        s.obfuscation_algorithm_ref = %22test_n%22%0A        s.is_defanged = %22test_o%22%0A        s.defanging_algorithm_ref = %22test_p%22%0A        s.refanging_transform_type = %22test_q%22%0A        s.refanging_transform = %22test_r%22%0A%0A        s2 = round_trip(s, String, output=True)%0A%0A        s_dict = s.to_dict()%0A        s2_dict = s2.to_dict()%0A        print s_dict%0A        print s2_dict%0A        self.assertEqual(s_dict, s2_dict)%0A%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A

Add tests for Attributes