コード例 #1
0
    def test_traverse_all_segment_codes_no_groups_no_loop(self):
        cuscar_schema = load_schema("schema_for_test.json")
        traverser = SchemaTraverser(cuscar_schema)

        all_segment_codes = [
            i['code'] for i in traverser.segment_generator(follow_loops=False)
        ]
        expected = ['UNA', 'UNB', 'BGM', 'DTM', 'UNT', 'UNZ']
        self.assertEqual(all_segment_codes, expected)
コード例 #2
0
    def test_traverse_all_segment_codes_with_groups_and_loops(self):
        cuscar_schema = load_schema("schema_for_test2.json")
        traverser = SchemaTraverser(cuscar_schema)

        all_segment_codes = [
            i['code'] for i in traverser.segment_generator(follow_loops=True)
        ]

        expected = [
            'UNA', 'UNB', 'AUT', 'DTM', 'DTM', 'DTM', 'DTM', 'DTM', 'DTM',
            'DTM', 'DTM', 'DTM', 'RFF', 'RFF', 'RFF', 'RFF', 'RFF', 'RFF',
            'RFF', 'RFF', 'RFF', 'UNT', 'UNZ'
        ]
        self.assertEqual(all_segment_codes, expected)