| 
									
										
										
										
											2025-04-03 10:39:47 +05:30
										 |  |  | #  Copyright 2025 Collate | 
					
						
							|  |  |  | #  Licensed under the Collate Community License, Version 1.0 (the "License"); | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  | #  you may not use this file except in compliance with the License. | 
					
						
							|  |  |  | #  You may obtain a copy of the License at | 
					
						
							| 
									
										
										
										
											2025-04-03 10:39:47 +05:30
										 |  |  | #  https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/LICENSE | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  | #  Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  | #  distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  | #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  | #  See the License for the specific language governing permissions and | 
					
						
							|  |  |  | #  limitations under the License. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | Avro parser tests | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | from unittest import TestCase | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from metadata.parsers.avro_parser import parse_avro_schema | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | SAMPLE_AVRO_SCHEMA = """
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |     { | 
					
						
							|  |  |  |     "namespace": "openmetadata.kafka", | 
					
						
							|  |  |  |     "name": "level", | 
					
						
							|  |  |  |     "type": "record", | 
					
						
							|  |  |  |     "doc": "This is a first level record", | 
					
						
							|  |  |  |     "fields": [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             "name": "uid", | 
					
						
							|  |  |  |             "type": "int", | 
					
						
							|  |  |  |             "doc": "The field represents unique id" | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             "name": "somefield", | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  |             "type": "string" | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             "name": "options", | 
					
						
							|  |  |  |             "doc": "The field represents options array", | 
					
						
							|  |  |  |             "type": { | 
					
						
							|  |  |  |                 "type": "array", | 
					
						
							|  |  |  |                 "items": { | 
					
						
							|  |  |  |                     "type": "record", | 
					
						
							|  |  |  |                     "name": "lvl2_record", | 
					
						
							|  |  |  |                     "doc": "The field represents a level 2 record", | 
					
						
							|  |  |  |                     "fields": [ | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             "name": "item1_lvl2", | 
					
						
							|  |  |  |                             "type": "string" | 
					
						
							|  |  |  |                         }, | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             "name": "item2_lvl2", | 
					
						
							|  |  |  |                             "doc": "level 2 array", | 
					
						
							|  |  |  |                             "type": { | 
					
						
							|  |  |  |                                 "type": "array", | 
					
						
							|  |  |  |                                 "items": { | 
					
						
							|  |  |  |                                     "type": "record", | 
					
						
							|  |  |  |                                     "name": "lvl3_record", | 
					
						
							|  |  |  |                                     "fields": [ | 
					
						
							|  |  |  |                                         { | 
					
						
							|  |  |  |                                             "name": "item1_lvl3", | 
					
						
							|  |  |  |                                             "type": "string", | 
					
						
							|  |  |  |                                             "doc": "The field represents level3 item" | 
					
						
							|  |  |  |                                         }, | 
					
						
							|  |  |  |                                         { | 
					
						
							|  |  |  |                                             "name": "item2_lvl3", | 
					
						
							|  |  |  |                                             "type": "string" | 
					
						
							|  |  |  |                                         } | 
					
						
							|  |  |  |                                     ] | 
					
						
							|  |  |  |                                 } | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     ] | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         } | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-06 16:27:06 +05:30
										 |  |  | RECURSIVE_AVRO_SCHEMA = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |    "name":"MainRecord", | 
					
						
							|  |  |  |    "type":"record", | 
					
						
							|  |  |  |    "fields":[ | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |          "default":"None", | 
					
						
							|  |  |  |          "name":"NestedRecord", | 
					
						
							|  |  |  |          "type":[ | 
					
						
							|  |  |  |             "null", | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                "fields":[ | 
					
						
							|  |  |  |                   { | 
					
						
							|  |  |  |                      "default":"None", | 
					
						
							|  |  |  |                      "name":"FieldA", | 
					
						
							|  |  |  |                      "type":[ | 
					
						
							|  |  |  |                         "null", | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                            "items":{ | 
					
						
							|  |  |  |                               "fields":[ | 
					
						
							|  |  |  |                                  { | 
					
						
							|  |  |  |                                     "name":"FieldAA", | 
					
						
							|  |  |  |                                     "type":"string" | 
					
						
							|  |  |  |                                  }, | 
					
						
							|  |  |  |                                  { | 
					
						
							|  |  |  |                                     "default":"None", | 
					
						
							|  |  |  |                                     "name":"FieldBB", | 
					
						
							|  |  |  |                                     "type":[ | 
					
						
							|  |  |  |                                        "null", | 
					
						
							|  |  |  |                                        "string" | 
					
						
							|  |  |  |                                     ] | 
					
						
							|  |  |  |                                  }, | 
					
						
							|  |  |  |                                  { | 
					
						
							|  |  |  |                                     "default":"None", | 
					
						
							|  |  |  |                                     "name":"FieldCC", | 
					
						
							|  |  |  |                                     "type":[ | 
					
						
							|  |  |  |                                        "null", | 
					
						
							|  |  |  |                                        "RecursionIssueRecord" | 
					
						
							|  |  |  |                                     ] | 
					
						
							|  |  |  |                                  } | 
					
						
							|  |  |  |                               ], | 
					
						
							|  |  |  |                               "name":"RecursionIssueRecord", | 
					
						
							|  |  |  |                               "type":"record" | 
					
						
							|  |  |  |                            }, | 
					
						
							|  |  |  |                            "type":"array" | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                      ] | 
					
						
							|  |  |  |                   } | 
					
						
							|  |  |  |                ], | 
					
						
							|  |  |  |                "name":"FieldInNestedRecord", | 
					
						
							|  |  |  |                "type":"record" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |          ] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |    ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | ARRAY_OF_STR = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": "string" | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARRAY_OF_ARRAY = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": { | 
					
						
							|  |  |  |           "type": "array", | 
					
						
							|  |  |  |           "items": "int" | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARRAY_OF_ARRAY_OF_RECORD = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": { | 
					
						
							|  |  |  |           "type": "array", | 
					
						
							|  |  |  |           "items": { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARRAY_OF_NESTED_ARRAY = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": { | 
					
						
							|  |  |  |           "type": "array", | 
					
						
							|  |  |  |           "items": { | 
					
						
							|  |  |  |             "type": "array", | 
					
						
							|  |  |  |             "items": { | 
					
						
							|  |  |  |                 "type": "array", | 
					
						
							|  |  |  |                 "items": { | 
					
						
							|  |  |  |                     "type": "array", | 
					
						
							|  |  |  |                     "items": "int" | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ARRAY_OF_NESTED_ARRAY_WITH_CHILD = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": { | 
					
						
							|  |  |  |           "type": "array", | 
					
						
							|  |  |  |           "items": { | 
					
						
							|  |  |  |             "type": "array", | 
					
						
							|  |  |  |             "items": { | 
					
						
							|  |  |  |                 "type": "array", | 
					
						
							|  |  |  |                 "items": { | 
					
						
							|  |  |  |                     "type": "array", | 
					
						
							|  |  |  |                     "items":{ | 
					
						
							|  |  |  |                         "type": "record", | 
					
						
							|  |  |  |                         "name": "Record", | 
					
						
							|  |  |  |                         "fields": [ | 
					
						
							|  |  |  |                             { | 
					
						
							|  |  |  |                             "name": "field1", | 
					
						
							|  |  |  |                             "type": "string" | 
					
						
							|  |  |  |                             }, | 
					
						
							|  |  |  |                             { | 
					
						
							|  |  |  |                             "name": "field2", | 
					
						
							|  |  |  |                             "type": "int" | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         ] | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_EXAMPLE_1 = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": ["null","int"] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_EXAMPLE_2 = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": ["null","int","string","boolean"] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_EXAMPLE_3 = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": [ | 
					
						
							|  |  |  |         "null", | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_EXAMPLE_4 = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": [ | 
					
						
							|  |  |  |         "null", | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record2", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_OF_STR_AND_RECORD = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "ArrayOfArrays", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": [ | 
					
						
							|  |  |  |         "string", | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_OF_ARRAY = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "UnionOfArray", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type":[ | 
					
						
							|  |  |  |             "null", | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             "type": "array", | 
					
						
							|  |  |  |             "items": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_OF_ARRAY_OF_RECORD = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "UnionOfArray", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type":[ | 
					
						
							|  |  |  |             "null", | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             "type": "array", | 
					
						
							|  |  |  |             "items": { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record2", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UNION_OF_ARRAY_OF_RECORD_1 = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "UnionOfArray", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "matrix", | 
					
						
							|  |  |  |       "type":[ | 
					
						
							|  |  |  |             "int", | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             "type": "array", | 
					
						
							|  |  |  |             "items": { | 
					
						
							|  |  |  |           "type": "record", | 
					
						
							|  |  |  |           "name": "Record2", | 
					
						
							|  |  |  |           "fields": [ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field1", | 
					
						
							|  |  |  |               "type": "string" | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |               "name": "field2", | 
					
						
							|  |  |  |               "type": "int" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           ] | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  | RECORD_INSIDE_RECORD = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "OuterRecord", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "id", | 
					
						
							|  |  |  |       "type": "int" | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "name", | 
					
						
							|  |  |  |       "type": "string" | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "innerRecord", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "record", | 
					
						
							|  |  |  |         "name": "InnerRecord", | 
					
						
							|  |  |  |         "fields": [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             "name": "address", | 
					
						
							|  |  |  |             "type": "string" | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             "name": "phoneNumbers", | 
					
						
							|  |  |  |             "type": { | 
					
						
							|  |  |  |               "type": "array", | 
					
						
							|  |  |  |               "items": "string" | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "tags", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "array", | 
					
						
							|  |  |  |         "items": "string" | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-10 18:26:42 +05:30
										 |  |  | RECURSION_ISSUE_SAMPLE = """
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   "type": "record", | 
					
						
							|  |  |  |   "name": "RecursionIssue", | 
					
						
							|  |  |  |   "namespace": "com.issue.recursion", | 
					
						
							|  |  |  |   "doc": "Schema with recursion issue", | 
					
						
							|  |  |  |   "fields": [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       "name": "issue", | 
					
						
							|  |  |  |       "type": { | 
					
						
							|  |  |  |         "type": "record", | 
					
						
							|  |  |  |         "name": "Issue", | 
					
						
							|  |  |  |         "doc": "Global Schema Name", | 
					
						
							|  |  |  |         "fields": [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             "name": "itemList", | 
					
						
							|  |  |  |             "default": null, | 
					
						
							|  |  |  |             "type": [ | 
					
						
							|  |  |  |               "null", | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 "type": "array", | 
					
						
							|  |  |  |                 "items": { | 
					
						
							|  |  |  |                   "type": "record", | 
					
						
							|  |  |  |                   "name": "Item", | 
					
						
							|  |  |  |                   "doc": "Item List  - Array of Sub Schema", | 
					
						
							|  |  |  |                   "fields": [ | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                       "name": "itemList", | 
					
						
							|  |  |  |                       "type": [ | 
					
						
							|  |  |  |                         "null", | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                           "type": "array", | 
					
						
							|  |  |  |                           "items": "Item" | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                       ], | 
					
						
							|  |  |  |                       "default": null | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                   ] | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         ] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | class AvroParserTests(TestCase): | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     Check methods from avro_parser.py | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |     """
 | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  |     parsed_schema = parse_avro_schema(SAMPLE_AVRO_SCHEMA) | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |     def test_first_level(self): | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  |         """
 | 
					
						
							|  |  |  |         Test nested schema | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         self.assertEqual(self.parsed_schema[0].name.root, "level") | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         self.assertEqual( | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             self.parsed_schema[0].description.root, "This is a first level record" | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         ) | 
					
						
							| 
									
										
										
										
											2023-03-07 06:40:04 -08:00
										 |  |  |         self.assertEqual(self.parsed_schema[0].dataType.name, "RECORD") | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |     def test_second_level(self): | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  |         """
 | 
					
						
							|  |  |  |         Test nested schema | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         children = self.parsed_schema[0].children | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         field_names = {str(field.name.root) for field in children} | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             field_names, | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |             {"uid", "somefield", "options"}, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_types = {str(field.dataType.name) for field in children} | 
					
						
							|  |  |  |         self.assertEqual(field_types, {"INT", "STRING", "ARRAY"}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_descriptions = { | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             field.description.root if field.description else None for field in children | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         } | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             field_descriptions, | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |                 "The field represents unique id", | 
					
						
							|  |  |  |                 None, | 
					
						
							|  |  |  |                 "The field represents options array", | 
					
						
							| 
									
										
										
										
											2022-11-11 16:35:09 +05:30
										 |  |  |             }, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |     def test_third_level(self): | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  |         """
 | 
					
						
							|  |  |  |         Test nested schema | 
					
						
							|  |  |  |         """
 | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         level3_record = self.parsed_schema[0].children[2].children[0] | 
					
						
							|  |  |  |         children = level3_record.children | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         self.assertEqual(level3_record.name.root, "lvl2_record") | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         self.assertEqual( | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             level3_record.description.root, "The field represents a level 2 record" | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual(level3_record.dataType.name, "RECORD") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         field_names = {str(field.name.root) for field in children} | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             field_names, | 
					
						
							|  |  |  |             {"item1_lvl2", "item2_lvl2"}, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_types = {str(field.dataType.name) for field in children} | 
					
						
							|  |  |  |         self.assertEqual(field_types, {"STRING", "ARRAY"}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_descriptions = { | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             field.description.root if field.description else None for field in children | 
					
						
							| 
									
										
										
										
											2023-03-07 06:40:04 -08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-03-08 20:16:50 +05:30
										 |  |  |         self.assertEqual(field_descriptions, {None, "level 2 array"}) | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_fourth_level(self): | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         Test nested schema | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         level3_record = self.parsed_schema[0].children[2].children[0] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         children = level3_record.children[1].children[0].children | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         field_names = {str(field.name.root) for field in children} | 
					
						
							| 
									
										
										
										
											2023-04-01 11:10:05 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             field_names, | 
					
						
							|  |  |  |             {"item1_lvl3", "item2_lvl3"}, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         field_types = {str(field.dataType.name) for field in children} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.assertEqual(field_types, {"STRING"}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def parse_schema_assert_without_child(self, schema: str, display: str): | 
					
						
							|  |  |  |         example = parse_avro_schema(schema) | 
					
						
							|  |  |  |         self.assertIsNotNone(example)  # is parsed | 
					
						
							|  |  |  |         field = example[0].children[0] | 
					
						
							|  |  |  |         self.assertEqual(field.dataTypeDisplay, display) | 
					
						
							|  |  |  |         self.assertIsNone(field.children)  # no child | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def parse_schema_assert_one_child(self, schema: str, display: str): | 
					
						
							|  |  |  |         example = parse_avro_schema(schema) | 
					
						
							|  |  |  |         self.assertIsNotNone(example)  # is parsed | 
					
						
							|  |  |  |         field = example[0].children[0] | 
					
						
							|  |  |  |         self.assertEqual(field.dataTypeDisplay, display) | 
					
						
							|  |  |  |         # has one child | 
					
						
							|  |  |  |         self.assertIsNotNone(field.children) | 
					
						
							|  |  |  |         self.assertEqual(len(field.children), 1) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_array_parsing(self): | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         Test array parsing | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child(ARRAY_OF_STR, "ARRAY<string>") | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child(ARRAY_OF_ARRAY, "ARRAY<ARRAY<int>>") | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child( | 
					
						
							|  |  |  |             ARRAY_OF_NESTED_ARRAY, "ARRAY<ARRAY<ARRAY<ARRAY<ARRAY<int>>>>>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_one_child( | 
					
						
							|  |  |  |             ARRAY_OF_ARRAY_OF_RECORD, "ARRAY<ARRAY<record>>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_one_child( | 
					
						
							|  |  |  |             ARRAY_OF_NESTED_ARRAY_WITH_CHILD, | 
					
						
							|  |  |  |             "ARRAY<ARRAY<ARRAY<ARRAY<ARRAY<record>>>>>", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_union_parsing(self): | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         Test union parsing | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child(UNION_EXAMPLE_1, "UNION<null,int>") | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child( | 
					
						
							|  |  |  |             UNION_EXAMPLE_2, "UNION<null,int,string,boolean>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_one_child(UNION_EXAMPLE_3, "UNION<null,record>") | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child( | 
					
						
							|  |  |  |             UNION_EXAMPLE_4, "UNION<null,record,record>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child(UNION_OF_ARRAY, "UNION<null,ARRAY<int>>") | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child( | 
					
						
							|  |  |  |             UNION_OF_STR_AND_RECORD, "UNION<string,record>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_one_child( | 
					
						
							|  |  |  |             UNION_OF_ARRAY_OF_RECORD, "UNION<null,ARRAY<record>>" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.parse_schema_assert_without_child( | 
					
						
							|  |  |  |             UNION_OF_ARRAY_OF_RECORD_1, "UNION<int,array>" | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_nested_record_parsing(self): | 
					
						
							|  |  |  |         parsed_record_schema = parse_avro_schema(RECORD_INSIDE_RECORD) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # test 1st level record | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         self.assertEqual(parsed_record_schema[0].name.root, "OuterRecord") | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  |         self.assertEqual(parsed_record_schema[0].dataType.name, "RECORD") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # test 2nd level record | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |         self.assertEqual(parsed_record_schema[0].children[2].name.root, "innerRecord") | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  |         self.assertEqual(parsed_record_schema[0].children[2].dataType.name, "RECORD") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # test fields inside 2nd level record | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             parsed_record_schema[0].children[2].children[0].name.root, "InnerRecord" | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             parsed_record_schema[0].children[2].children[0].dataType.name, "RECORD" | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             parsed_record_schema[0].children[2].children[0].children[1].name.root, | 
					
						
							| 
									
										
										
										
											2023-07-31 11:54:29 +05:30
										 |  |  |             "phoneNumbers", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             parsed_record_schema[0].children[2].children[0].children[1].dataType.name, | 
					
						
							|  |  |  |             "ARRAY", | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2023-11-06 16:27:06 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_recursive_record_parsing(self): | 
					
						
							|  |  |  |         parsed_recursive_schema = parse_avro_schema(RECURSIVE_AVRO_SCHEMA) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # test that the recursive schema stops processing after 1st occurrence | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             parsed_recursive_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             .name.root, | 
					
						
							| 
									
										
										
										
											2023-11-06 16:27:06 +05:30
										 |  |  |             "RecursionIssueRecord", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             parsed_recursive_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[2] | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             .name.root, | 
					
						
							| 
									
										
										
										
											2023-11-06 16:27:06 +05:30
										 |  |  |             "FieldCC", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             parsed_recursive_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[2] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							| 
									
										
										
										
											2024-06-05 21:18:37 +02:00
										 |  |  |             .name.root, | 
					
						
							| 
									
										
										
										
											2023-11-06 16:27:06 +05:30
										 |  |  |             "RecursionIssueRecord", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertIsNone( | 
					
						
							|  |  |  |             parsed_recursive_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[2] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2024-09-10 18:26:42 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_recursive_issue_parsing(self): | 
					
						
							|  |  |  |         recur_parsed_schema = parse_avro_schema(RECURSION_ISSUE_SAMPLE) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             recur_parsed_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .name.root, | 
					
						
							|  |  |  |             "Item", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertEqual( | 
					
						
							|  |  |  |             recur_parsed_schema[0].children[0].children[0].children[0].name.root, | 
					
						
							|  |  |  |             "itemList", | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         self.assertIsNone( | 
					
						
							|  |  |  |             recur_parsed_schema[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children[0] | 
					
						
							|  |  |  |             .children | 
					
						
							|  |  |  |         ) |