def test_struct_field_repeated_useavariable(self): xml_doc = ET.fromstring("""<field repeated="number_of_numbers" type="uint8">spare</field>""") self.assertEqual(structureparser.struct_field_repeated(xml_doc), "number_of_numbers")
def test_struct_field_repeated_negative(self): xml_doc = ET.fromstring("""<field repeated="-15" type="uint8">spare</field>""") self.assertRaises(ValueError, lambda : structureparser.struct_field_repeated(xml_doc))
def test_struct_field_repeated(self): xml_doc = ET.fromstring("""<field repeated="5" type="uint8">spare</field>""") self.assertEqual(structureparser.struct_field_repeated(xml_doc), 5)
def test_struct_field_repeated_default(self): xml_doc = ET.fromstring("""<field type="uint8">spare</field>""") self.assertEqual(structureparser.struct_field_repeated(xml_doc), 1)
def test_struct_field_repeated_useavariable(self): xml_doc = ET.fromstring( """<field repeated="number_of_numbers" type="uint8">spare</field>""" ) self.assertEqual(structureparser.struct_field_repeated(xml_doc), "number_of_numbers")
def test_struct_field_repeated_negative(self): xml_doc = ET.fromstring( """<field repeated="-15" type="uint8">spare</field>""") self.assertRaises( ValueError, lambda: structureparser.struct_field_repeated(xml_doc))