Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests migration to pytest #778

Merged
merged 16 commits into from
Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions tests/unit/development/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os

_dir = os.path.dirname(os.path.abspath(__file__))


def has_trailing_space(s):
return any(line != line.rstrip() for line in s.splitlines())


expected_table_component_doc = [
"A Table component.",
"This is a description of the component.",
"It's multiple lines long.",
"",
"Keyword arguments:",
"- children (a list of or a singular dash component, string or number; optional)",
"- optionalArray (list; optional): Description of optionalArray",
"- optionalBool (boolean; optional)",
"- optionalNumber (number; default 42)",
"- optionalObject (dict; optional)",
"- optionalString (string; default 'hello world')",
"- optionalNode (a list of or a singular dash component, "
"string or number; optional)",
"- optionalElement (dash component; optional)",
"- optionalEnum (a value equal to: 'News', 'Photos'; optional)",
"- optionalUnion (string | number; optional)",
"- optionalArrayOf (list of numbers; optional)",
"- optionalObjectOf (dict with strings as keys and values "
"of type number; optional)",
"- optionalObjectWithExactAndNestedDescription (dict; optional): "
"optionalObjectWithExactAndNestedDescription has the "
"following type: dict containing keys "
"'color', 'fontSize', 'figure'.",
"Those keys have the following types:",
" - color (string; optional)",
" - fontSize (number; optional)",
" - figure (dict; optional): Figure is a plotly graph object. "
"figure has the following type: dict containing "
"keys 'data', 'layout'.",
"Those keys have the following types:",
" - data (list of dicts; optional): data is a collection of traces",
" - layout (dict; optional): layout describes " "the rest of the figure",
"- optionalObjectWithShapeAndNestedDescription (dict; optional): "
"optionalObjectWithShapeAndNestedDescription has the "
"following type: dict containing keys "
"'color', 'fontSize', 'figure'.",
"Those keys have the following types:",
" - color (string; optional)",
" - fontSize (number; optional)",
" - figure (dict; optional): Figure is a plotly graph object. "
"figure has the following type: dict containing "
"keys 'data', 'layout'.",
"Those keys have the following types:",
" - data (list of dicts; optional): data is a collection of traces",
" - layout (dict; optional): layout describes " "the rest of the figure",
"- optionalAny (boolean | number | string | dict | " "list; optional)",
"- customProp (optional)",
"- customArrayProp (list; optional)",
"- data-* (string; optional)",
"- aria-* (string; optional)",
"- in (string; optional)",
"- id (string; optional)",
]
16 changes: 16 additions & 0 deletions tests/unit/development/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import json
import os
from collections import OrderedDict

import pytest

from . import _dir


@pytest.fixture
def load_test_metadata_json():
json_path = os.path.join(_dir, "metadata_test.json")
with open(json_path) as data_file:
json_string = data_file.read()
data = json.JSONDecoder(object_pairs_hook=OrderedDict).decode(json_string)
return data
Loading