Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romanin-rf committed Jan 7, 2024
1 parent 194680c commit 6384682
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tool.poetry]
name = "rsv"
version = "1.0.0"
version = "1.0.1"
description = "A module for reading and writing an RSV document file."
authors = ["Romanin <semina054@gmail.com>"]
repository = "https://github.com/romanin-rf/rsv"
license = "MIT"
readme = "README.md"
classifiers = [
Expand Down
3 changes: 1 addition & 2 deletions rsv/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def load(
self.io.seek(value_start_index)
elif data == b"\xFD":
rows.append(row.copy())
row = []
row.clear()
value_start_index = self.io.tell()
self.io.seek(value_start_index)
return rows
Empty file added tests/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import rsv

# ! Runtime Vars
sampledata = [
['Name', 'ID', 'Description', 'Data'],
['Romanin', '0', '', None, None]
]

# ! Tests
def test_read_write():
with open('test.rsv', 'wb') as file:
rsv.dump(sampledata, file)

with open('test.rsv', 'rb') as file:
rows = rsv.load(file)

for rindex, row in enumerate(rows):
for vindex, value in enumerate(row):
assert value == sampledata[rindex][vindex]

0 comments on commit 6384682

Please sign in to comment.