annotate Resources/CodeGeneration/Graveyard/playground4.py @ 1006:4f28d9459e31 toa2019092001

Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 20 Sep 2019 12:13:10 +0200
parents 6405435480ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
490
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
1 testYaml = """
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
2 enum SomeEnum:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
3 - january
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
4 - feb
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
5
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
6 struct Message0:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
7 a: string
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
8
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
9 struct Message1:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
10 a: string
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
11 b: int32
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
12 c: vector<Message0>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
13 d: SomeEnum = january
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
14 e: SomeEnum= january
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
15 f: SomeEnum=january
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
16 g: SomeEnum =january
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
17
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
18
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
19 # github.com/AlDanial/cloc
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
20 header2 :
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
21 cloc_version : 1.67
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
22 elapsed_seconds : int32_t
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
23
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
24 header :
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
25 cloc_version : 1.67
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
26 elapsed_seconds : int32_t
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
27 cloc_url : vector<map<string,int32>>
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
28 n_files : 1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
29 n_lines : 3
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
30 files_per_second : 221.393718659277
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
31 lines_per_second : 664.181155977831
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
32 report_file : IDL.idl.yaml
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
33 IDL :
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
34 nFiles: 1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
35 blank: 0
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
36 comment: 2
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
37 code: 1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
38 EnumSUM:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
39 - aaa
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
40 - bbb
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
41
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
42 SUM:
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
43 blank: 0
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
44 comment: 2
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
45 code: 1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
46 nFiles: 1
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
47 """
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
48
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
49 import yaml
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
50
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
51 b = yaml.load(testYaml)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
52 print(b)
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
53
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
54 c = {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
55 'enum SomeEnum': ['january', 'feb'],
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
56 'struct Message0': {'a': 'string'},
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
57 'struct Message1': {
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
58 'a': 'string',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
59 'b': 'int32',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
60 'c': 'vector<Message0>',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
61 'd': 'vector<map<string,int32>>',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
62 'e': 'SomeEnum= january',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
63 'f': 'SomeEnum=january',
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
64 'g': 'SomeEnum =january'
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
65 },
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
66 }
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
67
6470248790db ongoing codegen work
bgo-osimis
parents:
diff changeset
68 print(c)