flow.record 3.21.dev5__tar.gz → 3.21.dev7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flow_record-3.21.dev7/.gitattributes +1 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/PKG-INFO +1 -1
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/csvfile.py +3 -1
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/version.py +2 -2
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/PKG-INFO +1 -1
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/SOURCES.txt +33 -27
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/pyproject.toml +1 -1
- flow_record-3.21.dev7/tests/_data/.gitkeep +0 -0
- flow_record-3.21.dev7/tests/adapter/__init__.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/adapter}/test_avro.py +50 -1
- flow_record-3.21.dev5/tests/test_json_record_adapter.py → flow_record-3.21.dev7/tests/adapter/test_json.py +1 -2
- flow_record-3.21.dev7/tests/fieldtypes/__init__.py +0 -0
- flow_record-3.21.dev7/tests/packer/__init__.py +0 -0
- flow_record-3.21.dev7/tests/record/__init__.py +0 -0
- flow_record-3.21.dev5/tests/test_record_adapter.py → flow_record-3.21.dev7/tests/record/test_adapter.py +1 -2
- flow_record-3.21.dev7/tests/selector/__init__.py +0 -0
- flow_record-3.21.dev5/tests/test_regression.py → flow_record-3.21.dev7/tests/test_regressions.py +10 -0
- flow_record-3.21.dev7/tests/tools/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/tox.ini +4 -4
- flow_record-3.21.dev5/tests/standalone_test.py +0 -19
- flow_record-3.21.dev5/tests/test_avro_adapter.py +0 -58
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/.git-blame-ignore-revs +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/COPYRIGHT +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/LICENSE +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/MANIFEST.in +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/README.md +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/examples/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/examples/filesystem.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/examples/passivedns.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/examples/records.json +0 -0
- /flow_record-3.21.dev5/tests/selector_explain_example.py → /flow_record-3.21.dev7/examples/selectors.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/examples/tcpconn.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/archive.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/avro.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/broker.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/duckdb.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/elastic.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/jsonfile.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/line.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/mongo.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/split.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/splunk.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/sqlite.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/stream.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/text.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/adapter/xlsx.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/base.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/exceptions.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/credential.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/net/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/net/ip.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/net/ipv4.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/net/tcp.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/fieldtypes/net/udp.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/jsonpacker.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/packer.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/selector.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/stream.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/tools/__init__.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/tools/geoip.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/tools/rdump.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/utils.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow/record/whitelist.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/dependency_links.txt +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/entry_points.txt +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/requires.txt +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/flow.record.egg-info/top_level.txt +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/setup.cfg +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/tests/__init__.py +0 -0
- {flow_record-3.21.dev5/tests/docs → flow_record-3.21.dev7/tests/_docs}/Makefile +0 -0
- {flow_record-3.21.dev5/tests/docs → flow_record-3.21.dev7/tests/_docs}/conf.py +0 -0
- {flow_record-3.21.dev5/tests/docs → flow_record-3.21.dev7/tests/_docs}/index.rst +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/tests/_utils.py +0 -0
- /flow_record-3.21.dev5/tests/test_csv_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_csv.py +0 -0
- /flow_record-3.21.dev5/tests/test_elastic_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_elastic.py +0 -0
- /flow_record-3.21.dev5/tests/test_adapter_line.py → /flow_record-3.21.dev7/tests/adapter/test_line.py +0 -0
- /flow_record-3.21.dev5/tests/test_splunk_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_splunk.py +0 -0
- /flow_record-3.21.dev5/tests/test_sqlite_duckdb_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_sqlite_duckdb.py +0 -0
- /flow_record-3.21.dev5/tests/test_adapter_text.py → /flow_record-3.21.dev7/tests/adapter/test_text.py +0 -0
- /flow_record-3.21.dev5/tests/test_xlsx_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_xlsx.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/fieldtypes}/test_fieldtypes.py +0 -0
- /flow_record-3.21.dev5/tests/test_fieldtype_ip.py → /flow_record-3.21.dev7/tests/fieldtypes/test_ip.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/packer}/test_json_packer.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/packer}/test_packer.py +0 -0
- /flow_record-3.21.dev5/tests/test_record_descriptor.py → /flow_record-3.21.dev7/tests/record/test_descriptor.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/record}/test_multi_timestamp.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/record}/test_record.py +0 -0
- /flow_record-3.21.dev5/tests/test_compiled_selector.py → /flow_record-3.21.dev7/tests/selector/test_compiled.py +0 -0
- /flow_record-3.21.dev5/tests/test_selector.py → /flow_record-3.21.dev7/tests/selector/test_selectors.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/tests/test_deprecations.py +0 -0
- {flow_record-3.21.dev5 → flow_record-3.21.dev7}/tests/test_utils.py +0 -0
- {flow_record-3.21.dev5/tests → flow_record-3.21.dev7/tests/tools}/test_rdump.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tests/_data/** filter=lfs diff=lfs merge=lfs -text
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flow.record
|
|
3
|
-
Version: 3.21.
|
|
3
|
+
Version: 3.21.dev7
|
|
4
4
|
Summary: A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import contextlib
|
|
3
4
|
import csv
|
|
4
5
|
import sys
|
|
5
6
|
from pathlib import Path
|
|
@@ -89,7 +90,8 @@ class CsvfileReader(AbstractReader):
|
|
|
89
90
|
|
|
90
91
|
self.dialect = "excel"
|
|
91
92
|
if self.fp.seekable():
|
|
92
|
-
|
|
93
|
+
with contextlib.suppress(csv.Error):
|
|
94
|
+
self.dialect = csv.Sniffer().sniff(self.fp.read(1024))
|
|
93
95
|
self.fp.seek(0)
|
|
94
96
|
self.reader = csv.reader(self.fp, dialect=self.dialect)
|
|
95
97
|
|
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '3.21.
|
|
21
|
-
__version_tuple__ = version_tuple = (3, 21, '
|
|
20
|
+
__version__ = version = '3.21.dev7'
|
|
21
|
+
__version_tuple__ = version_tuple = (3, 21, 'dev7')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flow.record
|
|
3
|
-
Version: 3.21.
|
|
3
|
+
Version: 3.21.dev7
|
|
4
4
|
Summary: A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.git-blame-ignore-revs
|
|
2
|
+
.gitattributes
|
|
2
3
|
COPYRIGHT
|
|
3
4
|
LICENSE
|
|
4
5
|
MANIFEST.in
|
|
@@ -9,6 +10,7 @@ examples/__init__.py
|
|
|
9
10
|
examples/filesystem.py
|
|
10
11
|
examples/passivedns.py
|
|
11
12
|
examples/records.json
|
|
13
|
+
examples/selectors.py
|
|
12
14
|
examples/tcpconn.py
|
|
13
15
|
flow.record.egg-info/PKG-INFO
|
|
14
16
|
flow.record.egg-info/SOURCES.txt
|
|
@@ -54,32 +56,36 @@ flow/record/tools/geoip.py
|
|
|
54
56
|
flow/record/tools/rdump.py
|
|
55
57
|
tests/__init__.py
|
|
56
58
|
tests/_utils.py
|
|
57
|
-
tests/selector_explain_example.py
|
|
58
|
-
tests/standalone_test.py
|
|
59
|
-
tests/test_adapter_line.py
|
|
60
|
-
tests/test_adapter_text.py
|
|
61
|
-
tests/test_avro.py
|
|
62
|
-
tests/test_avro_adapter.py
|
|
63
|
-
tests/test_compiled_selector.py
|
|
64
|
-
tests/test_csv_adapter.py
|
|
65
59
|
tests/test_deprecations.py
|
|
66
|
-
tests/
|
|
67
|
-
tests/test_fieldtype_ip.py
|
|
68
|
-
tests/test_fieldtypes.py
|
|
69
|
-
tests/test_json_packer.py
|
|
70
|
-
tests/test_json_record_adapter.py
|
|
71
|
-
tests/test_multi_timestamp.py
|
|
72
|
-
tests/test_packer.py
|
|
73
|
-
tests/test_rdump.py
|
|
74
|
-
tests/test_record.py
|
|
75
|
-
tests/test_record_adapter.py
|
|
76
|
-
tests/test_record_descriptor.py
|
|
77
|
-
tests/test_regression.py
|
|
78
|
-
tests/test_selector.py
|
|
79
|
-
tests/test_splunk_adapter.py
|
|
80
|
-
tests/test_sqlite_duckdb_adapter.py
|
|
60
|
+
tests/test_regressions.py
|
|
81
61
|
tests/test_utils.py
|
|
82
|
-
tests/
|
|
83
|
-
tests/
|
|
84
|
-
tests/
|
|
85
|
-
tests/
|
|
62
|
+
tests/_data/.gitkeep
|
|
63
|
+
tests/_docs/Makefile
|
|
64
|
+
tests/_docs/conf.py
|
|
65
|
+
tests/_docs/index.rst
|
|
66
|
+
tests/adapter/__init__.py
|
|
67
|
+
tests/adapter/test_avro.py
|
|
68
|
+
tests/adapter/test_csv.py
|
|
69
|
+
tests/adapter/test_elastic.py
|
|
70
|
+
tests/adapter/test_json.py
|
|
71
|
+
tests/adapter/test_line.py
|
|
72
|
+
tests/adapter/test_splunk.py
|
|
73
|
+
tests/adapter/test_sqlite_duckdb.py
|
|
74
|
+
tests/adapter/test_text.py
|
|
75
|
+
tests/adapter/test_xlsx.py
|
|
76
|
+
tests/fieldtypes/__init__.py
|
|
77
|
+
tests/fieldtypes/test_fieldtypes.py
|
|
78
|
+
tests/fieldtypes/test_ip.py
|
|
79
|
+
tests/packer/__init__.py
|
|
80
|
+
tests/packer/test_json_packer.py
|
|
81
|
+
tests/packer/test_packer.py
|
|
82
|
+
tests/record/__init__.py
|
|
83
|
+
tests/record/test_adapter.py
|
|
84
|
+
tests/record/test_descriptor.py
|
|
85
|
+
tests/record/test_multi_timestamp.py
|
|
86
|
+
tests/record/test_record.py
|
|
87
|
+
tests/selector/__init__.py
|
|
88
|
+
tests/selector/test_compiled.py
|
|
89
|
+
tests/selector/test_selectors.py
|
|
90
|
+
tests/tools/__init__.py
|
|
91
|
+
tests/tools/test_rdump.py
|
|
@@ -125,7 +125,7 @@ select = [
|
|
|
125
125
|
ignore = ["E203", "B904", "UP024", "ANN002", "ANN003", "ANN204", "ANN401", "SIM105", "TRY003", "TRY400"]
|
|
126
126
|
|
|
127
127
|
[tool.ruff.lint.per-file-ignores]
|
|
128
|
-
"tests/
|
|
128
|
+
"tests/_docs/**" = ["INP001"]
|
|
129
129
|
|
|
130
130
|
[tool.ruff.lint.isort]
|
|
131
131
|
known-first-party = ["flow.record"]
|
|
File without changes
|
|
File without changes
|
|
@@ -5,9 +5,10 @@ from typing import TYPE_CHECKING
|
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
|
|
8
|
-
from flow.record import RecordDescriptor, RecordReader
|
|
8
|
+
from flow.record import RecordDescriptor, RecordReader, RecordWriter
|
|
9
9
|
from flow.record.adapter.avro import AvroReader, AvroWriter
|
|
10
10
|
from flow.record.base import HAS_AVRO
|
|
11
|
+
from tests._utils import generate_plain_records
|
|
11
12
|
|
|
12
13
|
if TYPE_CHECKING:
|
|
13
14
|
from collections.abc import Iterator
|
|
@@ -68,3 +69,51 @@ def test_avrostream_filelike_object(tmp_path: Path) -> None:
|
|
|
68
69
|
assert rec.name == f"record{index}"
|
|
69
70
|
assert rec.foo == "bar"
|
|
70
71
|
assert rec.bar == "baz"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_avro_adapter(tmpdir: Path) -> None:
|
|
75
|
+
json_file = tmpdir.join("records.avro")
|
|
76
|
+
record_adapter_path = f"avro://{json_file}"
|
|
77
|
+
writer = RecordWriter(record_adapter_path)
|
|
78
|
+
nr_records = 1337
|
|
79
|
+
|
|
80
|
+
for record in generate_plain_records(nr_records):
|
|
81
|
+
writer.write(record)
|
|
82
|
+
writer.flush()
|
|
83
|
+
|
|
84
|
+
nr_received_records = 0
|
|
85
|
+
reader = RecordReader(record_adapter_path)
|
|
86
|
+
for _ in reader:
|
|
87
|
+
nr_received_records += 1
|
|
88
|
+
|
|
89
|
+
assert nr_records == nr_received_records
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_avro_adapter_contextmanager(tmpdir: Path) -> None:
|
|
93
|
+
json_file = tmpdir.join("records.avro")
|
|
94
|
+
record_adapter_path = f"avro://{json_file}"
|
|
95
|
+
with RecordWriter(record_adapter_path) as writer:
|
|
96
|
+
nr_records = 1337
|
|
97
|
+
for record in generate_plain_records(nr_records):
|
|
98
|
+
writer.write(record)
|
|
99
|
+
|
|
100
|
+
nr_received_records = 0
|
|
101
|
+
with RecordReader(record_adapter_path) as reader:
|
|
102
|
+
for _ in reader:
|
|
103
|
+
nr_received_records += 1
|
|
104
|
+
|
|
105
|
+
assert nr_records == nr_received_records
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_avro_adapter_empty(tmpdir: Path) -> None:
|
|
109
|
+
json_file = tmpdir.join("records.avro")
|
|
110
|
+
record_adapter_path = f"avro://{json_file}"
|
|
111
|
+
with RecordWriter(record_adapter_path):
|
|
112
|
+
pass
|
|
113
|
+
|
|
114
|
+
nr_received_records = 0
|
|
115
|
+
with RecordReader(record_adapter_path) as reader:
|
|
116
|
+
for _ in reader:
|
|
117
|
+
nr_received_records += 1
|
|
118
|
+
|
|
119
|
+
assert nr_received_records == 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
flow_record-3.21.dev5/tests/test_regression.py → flow_record-3.21.dev7/tests/test_regressions.py
RENAMED
|
@@ -711,5 +711,15 @@ def test_rdump_selected_fields(capsysbinary: pytest.CaptureFixture) -> None:
|
|
|
711
711
|
assert captured.out == b"Q42eWSaF,A sample pastebin record,text\r\n"
|
|
712
712
|
|
|
713
713
|
|
|
714
|
+
def test_rdump_csv_sniff(tmp_path: Path, capsysbinary: pytest.CaptureFixture) -> None:
|
|
715
|
+
csv_path = tmp_path / "test.csv"
|
|
716
|
+
csv_path.write_text("ip,common_name,vulnerable\n127.0.0.1,localhost,1\n192.168.4.20,")
|
|
717
|
+
rdump.main([str(csv_path)])
|
|
718
|
+
|
|
719
|
+
captured = capsysbinary.readouterr()
|
|
720
|
+
assert b"<csv/reader ip='127.0.0.1' common_name='localhost' vulnerable='1'>" in captured.out
|
|
721
|
+
assert b"<csv/reader ip='192.168.4.20' common_name='' vulnerable=None>" in captured.out
|
|
722
|
+
|
|
723
|
+
|
|
714
724
|
if __name__ == "__main__":
|
|
715
725
|
__import__("standalone_test").main(globals())
|
|
File without changes
|
|
@@ -57,12 +57,12 @@ deps =
|
|
|
57
57
|
sphinx-design
|
|
58
58
|
furo
|
|
59
59
|
commands =
|
|
60
|
-
make -C tests/
|
|
61
|
-
make -C tests/
|
|
60
|
+
make -C tests/_docs clean
|
|
61
|
+
make -C tests/_docs html
|
|
62
62
|
|
|
63
63
|
[testenv:docs-linkcheck]
|
|
64
64
|
allowlist_externals = make
|
|
65
65
|
deps = {[testenv:docs-build]deps}
|
|
66
66
|
commands =
|
|
67
|
-
make -C tests/
|
|
68
|
-
make -C tests/
|
|
67
|
+
make -C tests/_docs clean
|
|
68
|
+
make -C tests/_docs linkcheck
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import traceback
|
|
4
|
-
from typing import Callable
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def main(glob: dict[str, Callable[..., None]]) -> None:
|
|
8
|
-
for var, val in sorted(glob.items()):
|
|
9
|
-
if not var.startswith("test_"):
|
|
10
|
-
continue
|
|
11
|
-
|
|
12
|
-
print(f"{var:40s}", end="")
|
|
13
|
-
try:
|
|
14
|
-
val()
|
|
15
|
-
print("PASSED")
|
|
16
|
-
except Exception:
|
|
17
|
-
print("FAILED")
|
|
18
|
-
|
|
19
|
-
traceback.print_exc()
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
4
|
-
|
|
5
|
-
from flow.record import RecordReader, RecordWriter
|
|
6
|
-
|
|
7
|
-
from ._utils import generate_plain_records
|
|
8
|
-
|
|
9
|
-
if TYPE_CHECKING:
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def test_avro_adapter(tmpdir: Path) -> None:
|
|
14
|
-
json_file = tmpdir.join("records.avro")
|
|
15
|
-
record_adapter_path = f"avro://{json_file}"
|
|
16
|
-
writer = RecordWriter(record_adapter_path)
|
|
17
|
-
nr_records = 1337
|
|
18
|
-
|
|
19
|
-
for record in generate_plain_records(nr_records):
|
|
20
|
-
writer.write(record)
|
|
21
|
-
writer.flush()
|
|
22
|
-
|
|
23
|
-
nr_received_records = 0
|
|
24
|
-
reader = RecordReader(record_adapter_path)
|
|
25
|
-
for _ in reader:
|
|
26
|
-
nr_received_records += 1
|
|
27
|
-
|
|
28
|
-
assert nr_records == nr_received_records
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_avro_adapter_contextmanager(tmpdir: Path) -> None:
|
|
32
|
-
json_file = tmpdir.join("records.avro")
|
|
33
|
-
record_adapter_path = f"avro://{json_file}"
|
|
34
|
-
with RecordWriter(record_adapter_path) as writer:
|
|
35
|
-
nr_records = 1337
|
|
36
|
-
for record in generate_plain_records(nr_records):
|
|
37
|
-
writer.write(record)
|
|
38
|
-
|
|
39
|
-
nr_received_records = 0
|
|
40
|
-
with RecordReader(record_adapter_path) as reader:
|
|
41
|
-
for _ in reader:
|
|
42
|
-
nr_received_records += 1
|
|
43
|
-
|
|
44
|
-
assert nr_records == nr_received_records
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def test_avro_adapter_empty(tmpdir: Path) -> None:
|
|
48
|
-
json_file = tmpdir.join("records.avro")
|
|
49
|
-
record_adapter_path = f"avro://{json_file}"
|
|
50
|
-
with RecordWriter(record_adapter_path):
|
|
51
|
-
pass
|
|
52
|
-
|
|
53
|
-
nr_received_records = 0
|
|
54
|
-
with RecordReader(record_adapter_path) as reader:
|
|
55
|
-
for _ in reader:
|
|
56
|
-
nr_received_records += 1
|
|
57
|
-
|
|
58
|
-
assert nr_received_records == 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/flow_record-3.21.dev5/tests/test_csv_adapter.py → /flow_record-3.21.dev7/tests/adapter/test_csv.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|