|
5 | 5 | from tests.test_files.test_cas_generators import MultiFeatureRandomCasGenerator, MultiTypeRandomCasGenerator |
6 | 6 | from tests.util import assert_json_equal |
7 | 7 |
|
8 | | -FIXTURE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_files", "json", "fs_as_array", "ser-ref") |
| 8 | +FIXTURE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_files", "json") |
| 9 | +SER_REF_DIR = os.path.join(FIXTURE_DIR, "fs_as_array", "ser-ref") |
9 | 10 |
|
10 | 11 | FIXTURES = [ |
11 | | - (os.path.join(FIXTURE_DIR, "casWithSofaDataArray"), []), |
12 | | - (os.path.join(FIXTURE_DIR, "casWithSofaDataURI"), []), |
13 | | - (os.path.join(FIXTURE_DIR, "casWithFloatingPointSpecialValues"), []), |
14 | | - (os.path.join(FIXTURE_DIR, "casWithText"), [["uima.tcas.DocumentAnnotation", 0, 15, "This is a test."]]), |
| 12 | + (os.path.join(SER_REF_DIR, "casWithSofaDataArray"), []), |
| 13 | + (os.path.join(SER_REF_DIR, "casWithSofaDataURI"), []), |
| 14 | + (os.path.join(SER_REF_DIR, "casWithFloatingPointSpecialValues"), []), |
| 15 | + (os.path.join(SER_REF_DIR, "casWithText"), [["uima.tcas.DocumentAnnotation", 0, 15, "This is a test."]]), |
15 | 16 | ( |
16 | | - os.path.join(FIXTURE_DIR, "casWithoutTextButWithAnnotations"), |
| 17 | + os.path.join(SER_REF_DIR, "casWithoutTextButWithAnnotations"), |
17 | 18 | [ |
18 | 19 | ["uima.tcas.Annotation", 0, 4, None], |
19 | 20 | ["uima.tcas.Annotation", 5, 7, None], |
|
22 | 23 | ], |
23 | 24 | ), |
24 | 25 | ( |
25 | | - os.path.join(FIXTURE_DIR, "casWithTextAndAnnotations"), |
| 26 | + os.path.join(SER_REF_DIR, "casWithTextAndAnnotations"), |
26 | 27 | [ |
27 | 28 | ["uima.tcas.Annotation", 0, 4, "This"], |
28 | 29 | ["uima.tcas.Annotation", 5, 7, "is"], |
|
32 | 33 | ], |
33 | 34 | ), |
34 | 35 | ( |
35 | | - os.path.join(FIXTURE_DIR, "casWithEmojiUnicodeTextAndAnnotations"), |
| 36 | + os.path.join(SER_REF_DIR, "casWithEmojiUnicodeTextAndAnnotations"), |
36 | 37 | [ |
37 | 38 | ["uima.tcas.Annotation", 0, 1, "🥳", b"\xf0\x9f\xa5\xb3"], |
38 | 39 | ["uima.tcas.Annotation", 2, 6, "This"], |
|
59 | 60 | ], |
60 | 61 | ), |
61 | 62 | ( |
62 | | - os.path.join(FIXTURE_DIR, "casWithLeftToRightTextAndAnnotations"), |
| 63 | + os.path.join(SER_REF_DIR, "casWithLeftToRightTextAndAnnotations"), |
63 | 64 | [ |
64 | 65 | ["uima.tcas.Annotation", 0, 3, "هذا"], |
65 | 66 | ["uima.tcas.Annotation", 4, 10, "اختبار"], |
66 | 67 | ["uima.tcas.DocumentAnnotation", 0, 10, "هذا اختبار"], |
67 | 68 | ], |
68 | 69 | ), |
69 | 70 | ( |
70 | | - os.path.join(FIXTURE_DIR, "casWithTraditionalChineseTextAndAnnotations"), |
| 71 | + os.path.join(SER_REF_DIR, "casWithTraditionalChineseTextAndAnnotations"), |
71 | 72 | [ |
72 | 73 | ["uima.tcas.Annotation", 0, 1, "這"], |
73 | 74 | ["uima.tcas.Annotation", 1, 2, "是"], |
@@ -172,3 +173,8 @@ def test_recursive_type_system(): |
172 | 173 | assert target_type_a.get_feature("typeB").rangeType.name == target_type_b.name |
173 | 174 | assert target_type_b is not None |
174 | 175 | assert target_type_b.get_feature("typeA").rangeType.name == target_type_a.name |
| 176 | + |
| 177 | + |
| 178 | +def test_deserializing_type_system_if_child_type_is_defined_before_supertype(): |
| 179 | + with open(os.path.join(FIXTURE_DIR, "child_type_before_parent.json"), "rb") as f: |
| 180 | + load_cas_from_json(f) |
0 commit comments