Skip to content

Commit 2cacf31

Browse files
committed
Fixed tests to run on GitHub Actions
1 parent cb20231 commit 2cacf31

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

tests/test_orjsonl.jsonl

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/test_orjsonl.jsonl.gz

-65 Bytes
Binary file not shown.

tests/test_orjsonl.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import orjsonl
44
from xopen import xopen
5+
import os
56

67
data = [
78
{'hello': 'world'},
@@ -19,6 +20,18 @@
1920

2021

2122

23+
def test_save() -> None:
24+
"""Test the saving functionality of the orjsonl Python library."""
25+
26+
orjsonl.save('test_orjsonl.jsonl', data=data)
27+
with open('test_orjsonl.jsonl', 'r', encoding='utf-8') as file:
28+
assert file.read() == jsonl
29+
30+
orjsonl.save('test_orjsonl.jsonl.gz', data=data)
31+
with xopen('test_orjsonl.jsonl.gz', 'r', encoding='utf-8') as file:
32+
assert file.read() == jsonl
33+
34+
2235
def test_stream() -> None:
2336
"""Test the streaming functionality of the orjsonl Python library."""
2437

@@ -58,14 +71,5 @@ def test_append() -> None:
5871
with xopen('test_orjsonl.jsonl.gz', 'r', encoding='utf-8') as file:
5972
assert file.read() == jsonl + '["a","b","c"]\ntest\n{"lorem":"ipsum"}\n'
6073

61-
62-
def test_save() -> None:
63-
"""Test the saving functionality of the orjsonl Python library."""
64-
65-
orjsonl.save('test_orjsonl.jsonl', data=data)
66-
with open('test_orjsonl.jsonl', 'r', encoding='utf-8') as file:
67-
assert file.read() == jsonl
68-
69-
orjsonl.save('test_orjsonl.jsonl.gz', data=data)
70-
with xopen('test_orjsonl.jsonl.gz', 'r', encoding='utf-8') as file:
71-
assert file.read() == jsonl
74+
os.remove('test_orjsonl.jsonl')
75+
os.remove('test_orjsonl.jsonl.gz')

0 commit comments

Comments
 (0)