Skip to content

Commit

Permalink
Test X-Ray image data
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyzz committed Jun 2, 2022
1 parent 48693b4 commit f6d6b12
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
34 changes: 33 additions & 1 deletion tests/XRAY.entities.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
{
"book_metadata": [
[
0,
607971,
1,
0,
0,
208,
547
547,
3,
"0,1,2"
]
],
"excerpt": [
[
0,
619,
0,
"kindle:embed:0002?mime=image/png",
null,
619
],
[
1,
1447,
77,
"kindle:embed:0005?mime=image/png",
null,
1283
],
[
2,
561087,
0,
"kindle:embed:0001?mime=image/png",
null,
561087
]
],
"occurrence": [
Expand Down
8 changes: 3 additions & 5 deletions tests/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ def convert(path, table, sql):
convert(
args.l,
"glosses",
"SELECT start, difficulty, sense_id FROM glosses "
f"ORDER BY start LIMIT {LIMIT}",
f"SELECT start, difficulty, sense_id FROM glosses ORDER BY start LIMIT {LIMIT}",
)
convert(args.l, "count", "SELECT count(*) FROM glosses")
convert(args.l, "metadata", "SELECT * FROM metadata")
if args.x:
convert(
args.x, "occurrence", f"SELECT * FROM occurrence ORDER BY start LIMIT {LIMIT}"
)
convert(
args.x, "book_metadata", "SELECT erl, num_people, num_terms FROM book_metadata"
)
convert(args.x, "book_metadata", "SELECT * FROM book_metadata")
convert(args.x, "type", "SELECT top_mentioned_entities FROM type")
convert(args.x, "excerpt", "SELECT * FROM excerpt")
10 changes: 9 additions & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_x_ray_book_metadata(self):
"XRAY.entities.json",
self.get_db_path(".asc"),
"book_metadata",
"SELECT erl, num_people, num_terms FROM book_metadata",
"SELECT * FROM book_metadata",
)

def test_x_ray_top_mentioned(self):
Expand All @@ -106,6 +106,14 @@ def test_x_ray_top_mentioned(self):
"SELECT top_mentioned_entities FROM type",
)

def test_x_ray_image_excerpt(self):
self.check_db(
"XRAY.entities.json",
self.get_db_path(".asc"),
"excerpt",
"SELECT * FROM excerpt",
)


if __name__ == "__main__":
r = unittest.TextTestRunner(verbosity=2).run(
Expand Down

0 comments on commit f6d6b12

Please sign in to comment.