예제 #1
0
def test_basic_report():
    r = Report()

    r.widget(None)
    with pytest.raises(pydantic.error_wrappers.ValidationError):
        r.header(None)
    r.header("Some header")
    r.header("Some header", description="Some description")
    with pytest.raises(pydantic.error_wrappers.ValidationError):
        r.text(None)
    r.text("Some text")
    r.text("Some header", description="Some description")

    assert len(r.elements) == 5
    config = r.get_configuration()
    assert isinstance(config, ReportConfiguration)
    assert len(config.elements) == 5
예제 #2
0
def f(value: Optional[str] = None):
    r = Report()
    r.text("# Report served with the API")
    if value is None:
        r.text(
            """
No value provided.


Try to add a value in the search string.

For example [like this](http://localhost:8000?value="with a value")
""",
            name="Result here",
        )
    else:
        r.text(f"The value was {value}", name="Result here")
    return r.get_configuration()
예제 #3
0
r.text("""
It is possible to just write some Markdown text.

### Sections

Use `#` for sections.

# H1
## H2
### H3
#### H4
##### H5
###### H6

### Links and images

You can include linked images:

![image](https://via.placeholder.com/300.png)

[via placeholder](https://placeholder.com/)

As well as links [**important** important link](#example)


### Code

    You can indent
    blocks to format
    code

Or wrap in backticks

```
print("Hello")
```

### Quotes

> You can insert block quotes by
> preceeding each line with `>`.
>
> Blockquotes can also contain line  
> breaks.


### Lists

- Unordered
* Lists
+ Of mixed type

1. Ordered
2. Lists
4. Numbers are ignored
    """

       # NOQA
       )