Esempio n. 1
0
 def test_all_fields(self):
     schema_reader = PythonSchemaReader(AllTypes)
     ast = schema_reader.get_ast()
     self.assertEquals(ast.root_struct_name, AllTypes.get_name())
     struct_names = sorted(
         [s.common.name for s in ast.structs])
     expected_struct_names = sorted([
         AllTypes.get_name(),
         NodeData.get_name(),
         A.get_name(),
         TestUnion.get_name()])
     self.assertEquals(
             struct_names, expected_struct_names)
Esempio n. 2
0
 def test_manually_added(self):
     """ tests whether dependant structs are detected
         and pulled into the schema """
     schema_reader = PythonSchemaReader(
             NodeData,
             struct_classes=[A])
     ast = schema_reader.get_ast()
     self.assertEquals(ast.root_struct_name, NodeData.get_name())
     struct_names = sorted(
         [s.common.name for s in ast.structs])
     expected_struct_names = sorted([
         A.get_name(),
         NodeData.get_name()])
     self.assertEquals(
             struct_names, expected_struct_names)