Skip to content

Commit

Permalink
Added tests for append() and extend() with newline set to `Fals…
Browse files Browse the repository at this point in the history
…e` to achieve 100% coverage.
  • Loading branch information
umarbutler committed Oct 8, 2023
1 parent 338988a commit ef8a215
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.1] - 2022-10-08

## Changed

- Added tests for `append()` and `extend()` with `newline` set to `False` to achieve 100% coverage.

## [0.3.0] - 2022-10-08

## Added
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "orjsonl"
version = "0.3.0"
version = "0.3.1"
authors = [
{name="Umar Butler", email="[email protected]"},
]
Expand Down
9 changes: 9 additions & 0 deletions tests/test_orjsonl.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def test_append(tmp_path) -> None:
helpers.save(tmp_path / 'test_orjsonl.jsonl', JSONL.encode('utf-8'))
orjsonl.append(tmp_path / 'test_orjsonl.jsonl', data=DATA[-1])
assert helpers.load(tmp_path / 'test_orjsonl.jsonl') == JSONL.encode('utf-8') + orjson.dumps(DATA[-1]) + b'\n'

helpers.save(tmp_path / 'test_orjsonl.jsonl', JSONL.encode('utf-8'))
orjsonl.append(tmp_path / 'test_orjsonl.jsonl', data=DATA[-1], newline=False)
assert helpers.load(tmp_path / 'test_orjsonl.jsonl') == JSONL.encode('utf-8') + b'\n' + orjson.dumps(DATA[-1]) + b'\n'


def test_extend(tmp_path) -> None:
Expand All @@ -50,3 +54,8 @@ def test_extend(tmp_path) -> None:
helpers.save(tmp_path / 'test_orjsonl.jsonl', JSONL.encode('utf-8'))
orjsonl.extend(tmp_path / 'test_orjsonl.jsonl', data=DATA[-2:])
assert helpers.load(tmp_path / 'test_orjsonl.jsonl') == JSONL.encode('utf-8') + orjson.dumps(DATA[-2]) + b'\n' + orjson.dumps(DATA[-1]) + b'\n'


helpers.save(tmp_path / 'test_orjsonl.jsonl', JSONL.encode('utf-8'))
orjsonl.extend(tmp_path / 'test_orjsonl.jsonl', data=DATA[-2:], newline=False)
assert helpers.load(tmp_path / 'test_orjsonl.jsonl') == JSONL.encode('utf-8') + b'\n' + orjson.dumps(DATA[-2]) + b'\n' + orjson.dumps(DATA[-1]) + b'\n'

0 comments on commit ef8a215

Please sign in to comment.