Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
 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))