-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding tests with toml-test * fix linting * more tests * remove debug * fix linting * tweak docs * uprev
- Loading branch information
1 parent
5743c16
commit 17c7bfa
Showing
14 changed files
with
325 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,16 @@ jobs: | |
coverage xml | ||
ls -alh | ||
- name: install go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
|
||
- name: run toml-test | ||
run: | | ||
go get github.com/BurntSushi/toml-test | ||
~/go/bin/toml-test ./tests/toml_test.py | ||
- uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rtoml" | ||
version = "0.1.1" | ||
version = "0.2.0" | ||
authors = ["Samuel Colvin <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from datetime import datetime, timezone, timedelta | ||
import rtoml | ||
|
||
obj = { | ||
'title': 'TOML Example', | ||
'owner': { | ||
'dob': datetime(1979, 5, 27, 7, 32, tzinfo=timezone(timedelta(hours=-8))), | ||
'name': 'Tom Preston-Werner', | ||
}, | ||
'database': { | ||
'connection_max': 5000, | ||
'enabled': True, | ||
'ports': [8001, 8001, 8002], | ||
'server': '192.168.1.1', | ||
}, | ||
} | ||
|
||
loaded_obj = rtoml.load("""\ | ||
# This is a TOML document. | ||
title = "TOML Example" | ||
[owner] | ||
name = "Tom Preston-Werner" | ||
dob = 1979-05-27T07:32:00-08:00 # First class dates | ||
[database] | ||
server = "192.168.1.1" | ||
ports = [8001, 8001, 8002] | ||
connection_max = 5000 | ||
enabled = true | ||
""") | ||
|
||
assert loaded_obj == obj | ||
|
||
assert rtoml.dumps(obj) == """\ | ||
title = "TOML Example" | ||
[owner] | ||
dob = 1979-05-27T07:32:00-08:00 | ||
name = "Tom Preston-Werner" | ||
[database] | ||
connection_max = 5000 | ||
enabled = true | ||
server = "192.168.1.1" | ||
ports = [8001, 8001, 8002] | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from datetime import datetime | ||
from typing import Any, Callable | ||
from datetime import date, time | ||
from typing import Any, Callable, Union | ||
|
||
VERSION: str | ||
|
||
def deserialize(toml: str, parse_datetime: Callable[[str], datetime]) -> Any: ... | ||
def deserialize(toml: str, parse_datetime: Callable[[str], Union[date, time]]) -> Any: ... | ||
def serialize(obj: Any) -> str: ... | ||
|
||
class TomlError(ValueError): ... | ||
class TomlParsingError(ValueError): ... | ||
class TomlSerializationError(ValueError): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
max_width = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.