-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d21a145
commit 9899ac9
Showing
8 changed files
with
128 additions
and
101 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
File renamed without changes.
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,35 @@ | ||
dataContractSpecification: 0.9.2 | ||
id: "61111-0002" | ||
info: | ||
title: "Verbraucherpreisindex: Deutschland, Monate" | ||
description: A data contract for the distribution and use of the German Consumer Price Index data. | ||
version: 1.0.0 | ||
owner: my-domain-team | ||
models: | ||
verbraucherpreisindex: | ||
description: Model representing the Consumer Price Index for Germany | ||
fields: | ||
wert: | ||
description: Value of the Consumer Price Index | ||
type: integer | ||
required: true | ||
jahrMonat: | ||
description: Year and month of the data | ||
type: string | ||
required: true | ||
qualitaet: | ||
description: Quality of the data | ||
type: string | ||
enum: | ||
- "vorlaeufig" | ||
- "endgueltig" | ||
|
||
examples: | ||
- type: json | ||
description: Example entry for CPI data | ||
model: verbraucherpreisindex | ||
data: |- | ||
[{ "wert": 99, "jahrMonat": "2022-00" }, | ||
{ "wert": 100, "jahrMonat": "2022-01" }, | ||
{ "wert": 101, "jahrMonat": "2022-02", "qualitaet": "vorlaeufig" }] | ||
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,25 @@ | ||
import logging | ||
|
||
import pytest | ||
from typer.testing import CliRunner | ||
|
||
from datacontract.cli import app | ||
from datacontract.data_contract import DataContract | ||
|
||
runner = CliRunner() | ||
|
||
logging.basicConfig(level=logging.DEBUG, force=True) | ||
|
||
def test_cli(): | ||
result = runner.invoke(app, ["test", "--examples", "./examples/examples/datacontract_inline.yaml"]) | ||
assert result.exit_code == 0 | ||
|
||
|
||
def test_json_inline(): | ||
data_contract = DataContract(data_contract_file="examples/examples/datacontract_inline.yaml", examples=True) | ||
run = data_contract.test() | ||
print(run) | ||
print(run.result) | ||
assert run.result == "passed" | ||
|
||
|
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