-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from jonathangreen/feature/inline-comments
Keep comments above a key-value pair as is
- Loading branch information
Showing
13 changed files
with
914 additions
and
123 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
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,34 @@ | ||
"""Fixtures shared across tests.""" | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
from typing import Callable, List | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(name="fixture_path") | ||
def get_fixture_path() -> Path: | ||
"""Fixture that returns the Path where example TOML files for the tests can | ||
be found.""" | ||
return Path(__file__).parent / "examples" | ||
|
||
|
||
@pytest.fixture() | ||
def get_fixture(fixture_path: Path) -> Callable[[str | List[str]], Path]: | ||
"""This fixture returns a callable that can be called to return a Path | ||
object for the fixture file.""" | ||
|
||
def getter(fixture_names: str | List[str]) -> Path: | ||
if isinstance(fixture_names, str): | ||
fixture_names = [fixture_names] | ||
|
||
fixture_names[-1] = f"{fixture_names[-1]}.toml" | ||
|
||
path = fixture_path | ||
for name in fixture_names: | ||
path /= name | ||
|
||
return path | ||
|
||
return getter |
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,52 @@ | ||
# My great TOML example | ||
# it has multiple lines | ||
|
||
# Orphan <- will be removed | ||
|
||
#Comment attached to title | ||
title = "The example" # test | ||
[c-section] | ||
foo = "bar" | ||
|
||
#start test | ||
[[a-section.hello]] | ||
#test comment | ||
ports = [ 8001, 8001, 8002 ] | ||
dob = 1979-05-27T07:32:00Z # First class dates? Why not? | ||
|
||
# Another test comment | ||
# make sure multiline comments work | ||
[[a-section.hello]] # Comment here? | ||
ports = [ 80 ] | ||
# multi line comment | ||
# test comment | ||
dob = 1920-05-27T07:32:00Z # Another date! | ||
|
||
# Another comment | ||
[b-section] #Comment there? | ||
date = "2018" # one more test | ||
name = "Richard Stallman" | ||
|
||
# I have a comment as well | ||
[a-section] | ||
# last one | ||
date = "2019" | ||
name = "Samuel Roeca" | ||
|
||
# Comment 123 | ||
[c-section.test] | ||
name = "Jonathan Green" | ||
|
||
#Wacky Waving Inflatable Arm-Flailing Tubeman | ||
[POWER] | ||
play = true#test | ||
|
||
# Comment 321 | ||
[c-section.test.x.y.z.baz] | ||
foo = "bar" | ||
|
||
# Comment 213 | ||
[c-section.test.x.y.z.bar] | ||
foo = "foo" | ||
|
||
#end test |
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,46 @@ | ||
# Comment attached to title | ||
title = "The example" # test | ||
|
||
# Wacky Waving Inflatable Arm-Flailing Tubeman | ||
[POWER] | ||
play = true # test | ||
|
||
# I have a comment as well | ||
[a-section] | ||
# last one | ||
date = "2019" | ||
name = "Samuel Roeca" | ||
|
||
# start test | ||
[[a-section.hello]] | ||
dob = 1979-05-27T07:32:00Z # First class dates? Why not? | ||
# test comment | ||
ports = [ 8001, 8001, 8002 ] | ||
|
||
# Another test comment | ||
# make sure multiline comments work | ||
[[a-section.hello]] # Comment here? | ||
# multi line comment | ||
# test comment | ||
dob = 1920-05-27T07:32:00Z # Another date! | ||
ports = [ 80 ] | ||
|
||
# Another comment | ||
[b-section] # Comment there? | ||
date = "2018" # one more test | ||
name = "Richard Stallman" | ||
|
||
[c-section] | ||
foo = "bar" | ||
|
||
# Comment 123 | ||
[c-section.test] | ||
name = "Jonathan Green" | ||
|
||
# Comment 213 | ||
[c-section.test.x.y.z.bar] | ||
foo = "foo" | ||
|
||
# Comment 321 | ||
[c-section.test.x.y.z.baz] | ||
foo = "bar" |
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,51 @@ | ||
# My great TOML example | ||
# it has multiple lines | ||
|
||
# Comment attached to title | ||
title = "The example" # test | ||
|
||
# Wacky Waving Inflatable Arm-Flailing Tubeman | ||
[POWER] | ||
play = true # test | ||
|
||
# I have a comment as well | ||
[a-section] | ||
# last one | ||
date = "2019" | ||
name = "Samuel Roeca" | ||
|
||
# start test | ||
[[a-section.hello]] | ||
# test comment | ||
ports = [ 8001, 8001, 8002 ] | ||
dob = 1979-05-27T07:32:00Z # First class dates? Why not? | ||
|
||
# Another test comment | ||
# make sure multiline comments work | ||
[[a-section.hello]] # Comment here? | ||
ports = [ 80 ] | ||
# multi line comment | ||
# test comment | ||
dob = 1920-05-27T07:32:00Z # Another date! | ||
|
||
# Another comment | ||
[b-section] # Comment there? | ||
date = "2018" # one more test | ||
name = "Richard Stallman" | ||
|
||
[c-section] | ||
foo = "bar" | ||
|
||
# Comment 123 | ||
[c-section.test] | ||
name = "Jonathan Green" | ||
|
||
# Comment 213 | ||
[c-section.test.x.y.z.bar] | ||
foo = "foo" | ||
|
||
# Comment 321 | ||
[c-section.test.x.y.z.baz] | ||
foo = "bar" | ||
|
||
# end test |
Oops, something went wrong.