code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _get_grid_lines(grid: list[list[int]]) -> tuple[list[ColRowGridLines], list[ColRowGridLines]]: """Gets list of ColRowGridLines for components and spaces on screen for validation and placement.""" component_grid_lines = [] unique_grid_idx = _get_unique_grid_component_ids(grid) for component_idx in un...
Gets list of ColRowGridLines for components and spaces on screen for validation and placement.
_get_grid_lines
python
mckinsey/vizro
vizro-core/src/vizro/models/_grid.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_grid.py
Apache-2.0
def build(self): """Creates empty container with inline style to later position components in.""" components_content = [ html.Div( id=f"{self.id}_{component_idx}", style={ "gridColumn": f"{grid_coord.col_start}/{grid_coord.col_end}", ...
Creates empty container with inline style to later position components in.
build
python
mckinsey/vizro
vizro-core/src/vizro/models/_grid.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_grid.py
Apache-2.0
def _build_inner_layout(layout, components): """Builds inner layout and adds components to grid or flex. Used inside `Page`, `Container` and `Form`.""" from vizro.models import Grid components_container = layout.build() if isinstance(layout, Grid): for idx, component in enumerate(components): ...
Builds inner layout and adds components to grid or flex. Used inside `Page`, `Container` and `Form`.
_build_inner_layout
python
mckinsey/vizro
vizro-core/src/vizro/models/_models_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_models_utils.py
Apache-2.0
def model_post_init(self, context: Any) -> None: """Adds the model instance to the model manager.""" try: super().model_post_init(context) except DuplicateIDError as exc: raise ValueError( f"Page with id={self.id} already exists. Page id is automatically s...
Adds the model instance to the model manager.
model_post_init
python
mckinsey/vizro
vizro-core/src/vizro/models/_page.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_page.py
Apache-2.0
def _get_control_states(self, control_type: ControlType) -> list[State]: """Gets list of `States` for selected `control_type` that appear on page where this Action is defined.""" # Possibly the code that specifies the state associated with a control will move to an inputs property # of the filte...
Gets list of `States` for selected `control_type` that appear on page where this Action is defined.
_get_control_states
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def _get_filter_interaction_states(self) -> list[dict[str, State]]: """Gets list of `States` for selected chart interaction `filter_interaction`.""" from vizro.actions import filter_interaction page = model_manager._get_model_page(self) return [ action._get_triggered_model()...
Gets list of `States` for selected chart interaction `filter_interaction`.
_get_filter_interaction_states
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def _transform_dependency(dependency: _IdOrIdProperty, type: Literal["output", "input"]) -> _IdProperty: """Transform a component dependency into its mapped property value. This method handles two formats of component dependencies: 1. Explicit format: "component-id.component-property" (e.g. "gr...
Transform a component dependency into its mapped property value. This method handles two formats of component dependencies: 1. Explicit format: "component-id.component-property" (e.g. "graph-1.figure") - Returns the mapped value if it exists in the component's _action_outputs/_action_inputs ...
_transform_dependency
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def _transformed_inputs(self) -> Union[list[State], dict[str, Union[State, ControlsStates]]]: """Creates Dash States given the user-specified runtime arguments and built in ones. Return type is list only for legacy actions. Otherwise, it will always be a dictionary (unlike for _transformed_outp...
Creates Dash States given the user-specified runtime arguments and built in ones. Return type is list only for legacy actions. Otherwise, it will always be a dictionary (unlike for _transformed_outputs, where new behavior can still give a list). Keys are the parameter names. For user-specified ...
_transformed_inputs
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def _transformed_outputs(self) -> Union[list[Output], dict[str, Output]]: """Creates Dash Output objects from string specifications in self.outputs. Converts self.outputs (list of strings or dictionary of strings where each string is in the format '<component_id>.<property>' or '<component_id>'...
Creates Dash Output objects from string specifications in self.outputs. Converts self.outputs (list of strings or dictionary of strings where each string is in the format '<component_id>.<property>' or '<component_id>') and converts into Dash Output objects. For example, ['my_graph.figure'] bec...
_transformed_outputs
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def build(self) -> html.Div: """Builds a callback for the Action model and returns required components for the callback. Returns: Div containing a list of required components (e.g. dcc.Download) for the Action model """ # TODO: after sorting out model manager and pre-build ...
Builds a callback for the Action model and returns required components for the callback. Returns: Div containing a list of required components (e.g. dcc.Download) for the Action model
build
python
mckinsey/vizro
vizro-core/src/vizro/models/_action/_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_action/_action.py
Apache-2.0
def _filter_interaction( self, data_frame: pd.DataFrame, target: str, ctd_filter_interaction: dict[str, CallbackTriggerDict] ) -> pd.DataFrame: """Function to be carried out for `filter_interaction`.""" # data_frame is the DF of the target, ie the data to be filtered, hence we cannot get the...
Function to be carried out for `filter_interaction`.
_filter_interaction
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/ag_grid.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/ag_grid.py
Apache-2.0
def _build_container(self): """Returns a collapsible container based on the `collapsed` state. If `collapsed` is `None`, returns a non-collapsible container. Otherwise, returns a collapsible container with visibility controlled by the `collapsed` flag. """ if self.collapsed is N...
Returns a collapsible container based on the `collapsed` state. If `collapsed` is `None`, returns a non-collapsible container. Otherwise, returns a collapsible container with visibility controlled by the `collapsed` flag.
_build_container
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/container.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/container.py
Apache-2.0
def _build_container_title(self): """Builds and returns the container title, including an optional icon and tooltip if collapsed.""" description = self.description.build().children if self.description is not None else [None] title_content = [ html.Div( [html.Span(id=...
Builds and returns the container title, including an optional icon and tooltip if collapsed.
_build_container_title
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/container.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/container.py
Apache-2.0
def _filter_interaction( self, data_frame: pd.DataFrame, target: str, ctd_filter_interaction: dict[str, CallbackTriggerDict] ) -> pd.DataFrame: """Function to be carried out for `filter_interaction`.""" # data_frame is the DF of the target, ie the data to be filtered, hence we cannot get the...
Function to be carried out for `filter_interaction`.
_filter_interaction
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/graph.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/graph.py
Apache-2.0
def _optimise_fig_layout_for_dashboard(fig): """Post layout updates to visually enhance charts used inside dashboard.""" # Determine if a title is present has_title = bool(fig.layout.title.text) # TODO: Check whether we should increase margins for all chart types in template_dashboard_o...
Post layout updates to visually enhance charts used inside dashboard.
_optimise_fig_layout_for_dashboard
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/graph.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/graph.py
Apache-2.0
def _filter_interaction( self, data_frame: pd.DataFrame, target: str, ctd_filter_interaction: dict[str, CallbackTriggerDict] ) -> pd.DataFrame: """Function to be carried out for `filter_interaction`.""" # data_frame is the DF of the target, ie the data to be filtered, hence we cannot get the...
Function to be carried out for `filter_interaction`.
_filter_interaction
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/table.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/table.py
Apache-2.0
def _get_list_of_labels(full_options: OptionsType) -> Union[list[StrictBool], list[float], list[str], list[date]]: """Returns a list of labels from the selector options provided.""" if all(isinstance(option, dict) for option in full_options): return [option["label"] for option in full_options] # type: ...
Returns a list of labels from the selector options provided.
_get_list_of_labels
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/dropdown.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/dropdown.py
Apache-2.0
def _calculate_option_height(full_options: OptionsType) -> int: """Calculates the height of the dropdown options based on the longest option.""" # 30 characters is roughly the number of "A" characters you can fit comfortably on a line in the dropdown. # "A" is representative of a slightly wider than average...
Calculates the height of the dropdown options based on the longest option.
_calculate_option_height
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/dropdown.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/dropdown.py
Apache-2.0
def _add_select_all_option(full_options: OptionsType) -> OptionsType: """Adds a 'Select All' option to the list of options.""" # TODO: Move option to dictionary conversion within `get_options_and_default` function as here: https://github.com/mckinsey/vizro/pull/961#discussion_r1923356781 options_dict = [ ...
Adds a 'Select All' option to the list of options.
_add_select_all_option
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/dropdown.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/dropdown.py
Apache-2.0
def get_options_and_default(options: OptionsType, multi: bool = False) -> tuple[OptionsType, SingleValueType]: """Gets list of full options and default value based on user input type of `options`.""" if multi: if all(isinstance(option, dict) for option in options): options = [{"label": ALL_O...
Gets list of full options and default value based on user input type of `options`.
get_options_and_default
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def is_value_contained(value: Union[SingleValueType, MultiValueType], options: OptionsType): """Checks if value is contained in a list.""" if isinstance(value, list): return all(item in options for item in value) else: return value in options
Checks if value is contained in a list.
is_value_contained
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def validate_options_dict(cls, data: Any) -> Any: """Reusable validator for the "options" argument of categorical selectors.""" if "options" not in data or not isinstance(data["options"], list): return data for entry in data["options"]: if isinstance(entry, dict) and not set(entry.keys()) =...
Reusable validator for the "options" argument of categorical selectors.
validate_options_dict
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def validate_value(value, info: ValidationInfo): """Reusable validator for the "value" argument of categorical selectors.""" if "options" not in info.data or not info.data["options"]: return value possible_values = ( [entry["value"] for entry in info.data["options"]] if isinstance(i...
Reusable validator for the "value" argument of categorical selectors.
validate_value
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def validate_max(max, info: ValidationInfo): """Validates that the `max` is not below the `min` for a range-based input.""" if max is None: return max if info.data["min"] is not None and max < info.data["min"]: raise ValueError("Maximum value of selector is required to be larger than minimu...
Validates that the `max` is not below the `min` for a range-based input.
validate_max
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def validate_range_value(value, info: ValidationInfo): """Validates a value or range of values to ensure they lie within specified bounds (min/max).""" EXPECTED_VALUE_LENGTH = 2 if value is None: return value lvalue, hvalue = ( (value[0], value[1]) if isinstance(value, list) and...
Validates a value or range of values to ensure they lie within specified bounds (min/max).
validate_range_value
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def validate_step(step, info: ValidationInfo): """Reusable validator for the "step" argument for sliders.""" if step is None: return step if info.data["max"] is not None and step > (info.data["max"] - info.data["min"]): raise ValueError( "The step value of the slider must be les...
Reusable validator for the "step" argument for sliders.
validate_step
python
mckinsey/vizro
vizro-core/src/vizro/models/_components/form/_form_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_components/form/_form_utils.py
Apache-2.0
def _get_proposed_targets(self): """Get all valid figure model targets for this control based on its location in the page hierarchy.""" page = model_manager._get_model_page(self) page_containers = model_manager._get_models(model_type=Container, root_model=page) # Find the control's pare...
Get all valid figure model targets for this control based on its location in the page hierarchy.
_get_proposed_targets
python
mckinsey/vizro
vizro-core/src/vizro/models/_controls/filter.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_controls/filter.py
Apache-2.0
def _get_control_parent(control: ControlType) -> Optional[VizroBaseModel]: """Get the parent model of a control.""" # Return None if the control is not part of any page. if (page := model_manager._get_model_page(model=control)) is None: return None # Return the Page if the control is its direct...
Get the parent model of a control.
_get_control_parent
python
mckinsey/vizro
vizro-core/src/vizro/models/_controls/_controls_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_controls/_controls_utils.py
Apache-2.0
def _create_nav_links(self, pages: list[ModelID]): """Creates a `NavLink` for each provided page.""" from vizro.models import Page nav_links = [] for page_id in pages: page = cast(Page, model_manager[page_id]) nav_links.append( dbc.NavLink( ...
Creates a `NavLink` for each provided page.
_create_nav_links
python
mckinsey/vizro
vizro-core/src/vizro/models/_navigation/accordion.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_navigation/accordion.py
Apache-2.0
def _validate_pages(pages: NavPagesType) -> NavPagesType: """Reusable validator to check if provided Page IDs exist as registered pages.""" from vizro.models import Page pages_as_list = list(itertools.chain(*pages.values())) if isinstance(pages, dict) else pages # Ideally we would use dashboard.pages i...
Reusable validator to check if provided Page IDs exist as registered pages.
_validate_pages
python
mckinsey/vizro
vizro-core/src/vizro/models/_navigation/_navigation_utils.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/models/_navigation/_navigation_utils.py
Apache-2.0
def dash_ag_grid(data_frame: pd.DataFrame, **kwargs: Any) -> dag.AgGrid: """Implementation of `dash_ag_grid.AgGrid` with sensible defaults to be used in [`AgGrid`][vizro.models.AgGrid]. Args: data_frame: DataFrame containing the data to be displayed. kwargs: Additional keyword arguments to be p...
Implementation of `dash_ag_grid.AgGrid` with sensible defaults to be used in [`AgGrid`][vizro.models.AgGrid]. Args: data_frame: DataFrame containing the data to be displayed. kwargs: Additional keyword arguments to be passed to the `dash_ag_grid.AgGrid` component. Returns: A `dash_ag_g...
dash_ag_grid
python
mckinsey/vizro
vizro-core/src/vizro/tables/_dash_ag_grid.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/tables/_dash_ag_grid.py
Apache-2.0
def dash_data_table(data_frame: pd.DataFrame, **kwargs: Any) -> dash_table.DataTable: """Standard `dash.dash_table.DataTable` with sensible defaults to be used in [`Table`][vizro.models.Table]. Args: data_frame: DataFrame containing the data to be displayed. kwargs: Additional keyword arguments...
Standard `dash.dash_table.DataTable` with sensible defaults to be used in [`Table`][vizro.models.Table]. Args: data_frame: DataFrame containing the data to be displayed. kwargs: Additional keyword arguments to be passed to the `dash_table.DataTable` component. Returns: A `dash.dash_tab...
dash_data_table
python
mckinsey/vizro
vizro-core/src/vizro/tables/_dash_table.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/tables/_dash_table.py
Apache-2.0
def _extract_last_two_occurrences(variable: str, css_content: str) -> tuple[Optional[str], Optional[str]]: """Extracts the last two occurrences of a variable from the CSS content. Within the `vizro-bootstrap.min.css` file, variables appear multiple times: initially from the default Bootstrap values, follow...
Extracts the last two occurrences of a variable from the CSS content. Within the `vizro-bootstrap.min.css` file, variables appear multiple times: initially from the default Bootstrap values, followed by the dark theme, and lastly the light theme. We are interested in the final two occurrences, as these rep...
_extract_last_two_occurrences
python
mckinsey/vizro
vizro-core/src/vizro/_themes/generate_plotly_templates.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/_themes/generate_plotly_templates.py
Apache-2.0
def extract_bs_variables_from_css(variables: list[str], css_content: str) -> tuple[dict[str, str], dict[str, str]]: """Extract the last two occurrences for each variable in the CSS file.""" extracted_dark = {} extracted_light = {} for variable in variables: dark_value, light_value = _extract_la...
Extract the last two occurrences for each variable in the CSS file.
extract_bs_variables_from_css
python
mckinsey/vizro
vizro-core/src/vizro/_themes/generate_plotly_templates.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/_themes/generate_plotly_templates.py
Apache-2.0
def generate_json_template(extracted_values: dict[str, str]) -> go.layout.Template: """Generates the Plotly JSON chart template.""" FONT_COLOR_PRIMARY = extracted_values["BS-PRIMARY"] BG_COLOR = extracted_values["BS-BODY-BG"] FONT_COLOR_SECONDARY = extracted_values["BS-SECONDARY"] GRID_COLOR = extra...
Generates the Plotly JSON chart template.
generate_json_template
python
mckinsey/vizro
vizro-core/src/vizro/_themes/generate_plotly_templates.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/_themes/generate_plotly_templates.py
Apache-2.0
def create_template_common() -> go.layout.Template: """Creates template with common values for dark and light theme. Returns: A plotly template object, see https://plotly.com/python/reference/layout/. """ COLORS = get_colors() template_common = go.layout.Template() template_common.layout = go.L...
Creates template with common values for dark and light theme. Returns: A plotly template object, see https://plotly.com/python/reference/layout/.
create_template_common
python
mckinsey/vizro
vizro-core/src/vizro/_themes/_common_template.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/src/vizro/_themes/_common_template.py
Apache-2.0
def dash_br_driver(dash_br, request): """Built-in driver from the dash library.""" port = request.param.get("port", cnst.DEFAULT_PORT) if hasattr(request, "param") else cnst.DEFAULT_PORT path = request.param.get("path", "") if hasattr(request, "param") else "" dash_br.driver.set_window_size(1920, 1080) ...
Built-in driver from the dash library.
dash_br_driver
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/conftest.py
Apache-2.0
def teardown_method(dash_br): """Fixture checks log errors and quits the driver after each test.""" yield # checking for browser console errors if os.getenv("BROWSER") in ["chrome", "chrome_mobile"]: try: error_logs = [log for log in dash_br.get_logs() if log["level"] == "SEVERE" or ...
Fixture checks log errors and quits the driver after each test.
teardown_method
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/conftest.py
Apache-2.0
def bar_with_highlight(data_frame, x, highlight_bar=None): """Custom chart to test using DatePicker with Parameter.""" fig = px.bar(data_frame=data_frame, x=x) fig["data"][0]["marker"]["color"] = ["orange" if c == highlight_bar else "blue" for c in fig["data"][0]["x"]] return fig
Custom chart to test using DatePicker with Parameter.
bar_with_highlight
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/custom_components/custom_charts/bar_custom.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/custom_components/custom_charts/bar_custom.py
Apache-2.0
def test_export_filtered_data(dash_br): """Test exporting filtered data. It is prefiltered in dashboard config.""" page_select( dash_br, page_path=cnst.FILTERS_PAGE_PATH, page_name=cnst.FILTERS_PAGE, ) # download files and compare it with base ones dash_br.multiple_click(but...
Test exporting filtered data. It is prefiltered in dashboard config.
test_export_filtered_data
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_actions.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_actions.py
Apache-2.0
def test_scatter_click_data_custom_action(dash_br): """Test custom action for changing data in card by interacting with graph.""" page_select( dash_br, page_name=cnst.FILTER_INTERACTIONS_PAGE, ) # click on the dot in the scatter graph and check card text values dash_br.click_at_coor...
Test custom action for changing data in card by interacting with graph.
test_scatter_click_data_custom_action
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_actions.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_actions.py
Apache-2.0
def test_modebar(dash_br): """Check that modebar element exist for the chart.""" dash_br.multiple_click(f"a[href='{cnst.FILTERS_PAGE_PATH}']", 1) dash_br.wait_for_element(f"#{cnst.SCATTER_GRAPH_ID} .modebar-container div[id^='modebar']")
Check that modebar element exist for the chart.
test_modebar
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_charts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_charts.py
Apache-2.0
def test_modebar_false(dash_br): """Check that modebar element disabled for the chart.""" dash_br.multiple_click(f"a[href='{cnst.FILTERS_PAGE_PATH}']", 1) graph_load_waiter(dash_br, cnst.BOX_GRAPH_ID) dash_br.wait_for_no_elements(f'div[id="{cnst.BOX_GRAPH_ID}"] .modebar-container div[id^="modebar"]')
Check that modebar element disabled for the chart.
test_modebar_false
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_charts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_charts.py
Apache-2.0
def test_custom_dropdown(dash_br): """Testing setting up and filter of the custom dropdown.""" page_select( dash_br, page_name=cnst.CUSTOM_COMPONENTS_PAGE, ) # choose 'versicolor' value select_dropdown_value(dash_br, value=2, dropdown_id=cnst.CUSTOM_DROPDOWN_ID) check_graph_is_lo...
Testing setting up and filter of the custom dropdown.
test_custom_dropdown
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_custom_components.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_custom_components.py
Apache-2.0
def test_custom_range_slider(dash_br): """Testing setting up and filter of the custom range slider.""" page_select( dash_br, page_name=cnst.CUSTOM_COMPONENTS_PAGE, ) dash_br.multiple_click(slider_value_path(elem_id=cnst.CUSTOM_RANGE_SLIDER_ID, value=4), 1) check_graph_is_loading(dash...
Testing setting up and filter of the custom range slider.
test_custom_range_slider
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_custom_components.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_custom_components.py
Apache-2.0
def test_single_date(dash_br): """Tests that single datepicker as filter works correctly.""" accordion_select(dash_br, accordion_name=cnst.DATEPICKER_ACCORDION) page_select( dash_br, page_name=cnst.DATEPICKER_PAGE, ) # open datepicker calendar and choose date 17 May 2016 dash_br...
Tests that single datepicker as filter works correctly.
test_single_date
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_datepicker.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_datepicker.py
Apache-2.0
def test_single_date_param(dash_br): """Tests that single datepicker as parameter works correctly.""" accordion_select(dash_br, accordion_name=cnst.DATEPICKER_ACCORDION) page_select( dash_br, page_name=cnst.DATEPICKER_PARAMS_PAGE, ) # check that specific bar has blue color dash_b...
Tests that single datepicker as parameter works correctly.
test_single_date_param
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_datepicker.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_datepicker.py
Apache-2.0
def test_data_dynamic_parametrization(dash_br, cache, slider_id): """This test checks parametrized data loading and how it is working with and without cache.""" first_screen = f"{cache}_screen_first_test_data_dynamic_parametrization.png" second_screen = f"{cache}_screen_second_test_data_dynamic_parametrizat...
This test checks parametrized data loading and how it is working with and without cache.
test_data_dynamic_parametrization
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
Apache-2.0
def test_numerical_filters(dash_br): """Initial selected value for slider is 6. Initial selected values for range_slider are 6 and 7.""" accordion_select(dash_br, accordion_name=cnst.DYNAMIC_DATA_ACCORDION) page_select( dash_br, page_name=cnst.DYNAMIC_FILTERS_NUMERICAL_PAGE, ) # Set...
Initial selected value for slider is 6. Initial selected values for range_slider are 6 and 7.
test_numerical_filters
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
Apache-2.0
def test_dynamic_data_parameter_refresh_dynamic_filters(dash_br): """Test automatic refreshing of the dynamic filters and their targets when the data_frame parameter is changed. Page configuration includes dynamic data scatter chart which controls by slider parameter and static data scatter which has 'virg...
Test automatic refreshing of the dynamic filters and their targets when the data_frame parameter is changed. Page configuration includes dynamic data scatter chart which controls by slider parameter and static data scatter which has 'virginica' data only.
test_dynamic_data_parameter_refresh_dynamic_filters
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_dynamic_data.py
Apache-2.0
def test_dropdown_homepage(dash_br): """Test dropdown filter for the homepage.""" graph_load_waiter(dash_br, graph_id=cnst.AREA_GRAPH_ID) # select 'setosa' select_dropdown_value(dash_br, value=2, dropdown_id=cnst.DROPDOWN_FILTER_HOMEPAGEPAGE) check_graph_is_loading(dash_br, cnst.AREA_GRAPH_ID)
Test dropdown filter for the homepage.
test_dropdown_homepage
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_filters.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_filters.py
Apache-2.0
def test_filter_and_parameter(dash_br): """Testing filter and parameter on the same page.""" page_select( dash_br, page_name=cnst.FILTER_AND_PARAM_PAGE, ) # check that title of the graph is 'blue' dash_br.wait_for_text_to_equal(".gtitle", "blue") # select 'red' value in the rad...
Testing filter and parameter on the same page.
test_filter_and_parameter
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_filter_and_param_config.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_filter_and_param_config.py
Apache-2.0
def test_interactions(dash_br): """Test filter interactions between two graphs.""" page_select( dash_br, page_name=cnst.FILTER_INTERACTIONS_PAGE, ) # click on the 'setosa' data in scatter graph and check result for box graph dash_br.click_at_coord_fractions(f"#{cnst.SCATTER_INTERACT...
Test filter interactions between two graphs.
test_interactions
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_interactions.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_interactions.py
Apache-2.0
def test_pages(dash_br): """Test of going from homepage to filters page and back using card link.""" # open homepage and check title text graph_load_waiter(dash_br, graph_id=cnst.AREA_GRAPH_ID) dash_br.wait_for_text_to_equal(page_title_path(), cnst.HOME_PAGE) # open filters page using card link and...
Test of going from homepage to filters page and back using card link.
test_pages
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
Apache-2.0
def test_active_accordion(dash_br): """Test opening page from card link and checking appropriate accordion is opened.""" graph_load_waiter(dash_br, graph_id=cnst.AREA_GRAPH_ID) dash_br.multiple_click(nav_card_link_path(href=f"/{cnst.DATEPICKER_PAGE}"), 1) graph_load_waiter(dash_br, graph_id=cnst.BAR_POP...
Test opening page from card link and checking appropriate accordion is opened.
test_active_accordion
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
Apache-2.0
def test_404_page(dash_br): """Test opening page that doesn't exist.""" graph_load_waiter(dash_br, graph_id=cnst.AREA_GRAPH_ID) dash_br.multiple_click(nav_card_link_path(href=cnst.PAGE_404_PATH), 1) dash_br.wait_for_text_to_equal("a[class='mt-4 btn btn-primary']", "Take me home") dash_br.multiple_cl...
Test opening page that doesn't exist.
test_404_page
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_pages.py
Apache-2.0
def test_sliders_state(dash_br): """Verify that sliders values stays the same after page reload.""" page_select( dash_br, page_path=cnst.PARAMETERS_PAGE_PATH, page_name=cnst.PARAMETERS_PAGE, ) # change slider value to '0.4' dash_br.multiple_click(slider_value_path(elem_id=cn...
Verify that sliders values stays the same after page reload.
test_sliders_state
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_parameters.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_parameters.py
Apache-2.0
def test_none_parameter(dash_br): """Test if one of the parameter values is NONE.""" page_select( dash_br, page_path=cnst.PARAMETERS_PAGE_PATH, page_name=cnst.PARAMETERS_PAGE, ) # check that specific bar has blue color dash_br.wait_for_element( f"div[id='{cnst.BAR_GR...
Test if one of the parameter values is NONE.
test_none_parameter
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_parameters.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_parameters.py
Apache-2.0
def test_parameters_title(chrome_driver, dash_br): """Tests that graph title is changing by parameter independently for every user.""" # select parameters page for the first user page_select_selenium( chrome_driver, page_path=cnst.PARAMETERS_PAGE_PATH, page_name=cnst.PARAMETERS_PAGE,...
Tests that graph title is changing by parameter independently for every user.
test_parameters_title
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
Apache-2.0
def test_theme_color(chrome_driver, dash_br): """Tests that theme color is changing independently for every user.""" # select parameters page for the first user page_select_selenium( chrome_driver, page_path=cnst.PARAMETERS_PAGE_PATH, page_name=cnst.PARAMETERS_PAGE, ) # sele...
Tests that theme color is changing independently for every user.
test_theme_color
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
Apache-2.0
def test_export_action(chrome_driver, dash_br): """Tests that export action is giving different results according to what every user filters.""" # select filters page for the first user page_select_selenium( chrome_driver, page_path=cnst.FILTERS_PAGE_PATH, page_name=cnst.FILTERS_PAGE...
Tests that export action is giving different results according to what every user filters.
test_export_action
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_statelessness.py
Apache-2.0
def test_interactions(dash_br): """Test filter interaction between table and line graph.""" accordion_select(dash_br, accordion_name=cnst.AG_GRID_ACCORDION) page_select( dash_br, page_name=cnst.TABLE_INTERACTIONS_PAGE, ) # click on Bosnia and Herzegovina country dash_br.multiple_...
Test filter interaction between table and line graph.
test_interactions
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_table.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_table.py
Apache-2.0
def test_interactions(dash_br): """Test filter interaction between ag_grid and line graph.""" accordion_select(dash_br, accordion_name=cnst.AG_GRID_ACCORDION) page_select( dash_br, page_name=cnst.TABLE_AG_GRID_INTERACTIONS_PAGE, ) # check if column 'country' is available dash_br...
Test filter interaction between ag_grid and line graph.
test_interactions
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_table_ag_grid.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_table_ag_grid.py
Apache-2.0
def test_themes(dash_br_driver, dashboard_id): """Test switching the themes and checking the graph and theme color.""" page_select(dash_br_driver, page_path=cnst.FILTERS_PAGE_PATH, page_name=cnst.FILTERS_PAGE) if dashboard_id == cnst.DASHBOARD_DEFAULT: # dashboard loaded with light theme ch...
Test switching the themes and checking the graph and theme color.
test_themes
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_themes.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_themes.py
Apache-2.0
def test_themes_page_change(dash_br_driver, dashboard_id): """Test switching themes after reloading the page with two tabs.""" page_select( dash_br_driver, page_path=cnst.PARAMETERS_PAGE_PATH, page_name=cnst.PARAMETERS_PAGE, ) def _logic(style_background, graph_color, theme_colo...
Test switching themes after reloading the page with two tabs.
test_themes_page_change
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_dom_elements/test_themes.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_dom_elements/test_themes.py
Apache-2.0
def image_assertion(func): """Wait until all callbacks are finished and compare screenshots.""" def wrapper(dash_br, request): result = func(dash_br) callbacks_finish_waiter(dash_br) time.sleep(1) # to finish page loading result_image_path, expected_image_path = make_screenshot...
Wait until all callbacks are finished and compare screenshots.
image_assertion
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_screenshots/test_screenshots.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_screenshots/test_screenshots.py
Apache-2.0
def test_collapsible_subcontainers_flex(dash_br): """Test that after closing subcontainer the parent container is still open.""" accordion_select(dash_br, accordion_name=cnst.LAYOUT_ACCORDION) page_select(dash_br, page_name=cnst.COLLAPSIBLE_CONTAINERS_FLEX) # close subcontainer dash_br.multiple_cli...
Test that after closing subcontainer the parent container is still open.
test_collapsible_subcontainers_flex
python
mckinsey/vizro
vizro-core/tests/e2e/vizro/test_screenshots/test_screenshots.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/e2e/vizro/test_screenshots/test_screenshots.py
Apache-2.0
def _strip_keys(object, keys): """Strips from a JSON `object` all entries where the key is in keys, regardless of how deeply it's nested.""" if isinstance(object, dict): object = {key: _strip_keys(value, keys) for key, value in object.items() if key not in keys} elif isinstance(object, list): ...
Strips from a JSON `object` all entries where the key is in keys, regardless of how deeply it's nested.
_strip_keys
python
mckinsey/vizro
vizro-core/tests/tests_utils/asserts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/asserts.py
Apache-2.0
def assert_component_equal(left, right, *, keys_to_strip=None): """Checks that the `left` and `right` Dash components are equal, ignoring `keys_to_strip`. Args: left: Dash component to compare. right: Dash component to compare. keys_to_strip: Keys to strip from the component dictionary ...
Checks that the `left` and `right` Dash components are equal, ignoring `keys_to_strip`. Args: left: Dash component to compare. right: Dash component to compare. keys_to_strip: Keys to strip from the component dictionary before comparison. If keys_to_strip is set to STRIP_ALL the...
assert_component_equal
python
mckinsey/vizro
vizro-core/tests/tests_utils/asserts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/asserts.py
Apache-2.0
def make_screenshot_and_paths(driver, request_node_name): """Creates image paths and makes screenshot during the test run.""" result_image_path = f"{request_node_name}_branch.png" expected_image_path = ( f"tests/e2e/screenshots/{os.getenv('BROWSER', 'chrome')}/{request_node_name.replace('test', 'mai...
Creates image paths and makes screenshot during the test run.
make_screenshot_and_paths
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/asserts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/asserts.py
Apache-2.0
def assert_image_equal(result_image_path, expected_image_path): """Comparison logic and diff files creation.""" expected_image_name = Path(expected_image_path).name try: assert_pixelmatch(result_image_path, expected_image_path) Path(result_image_path).unlink() except subprocess.CalledPro...
Comparison logic and diff files creation.
assert_image_equal
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/asserts.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/asserts.py
Apache-2.0
def browser_console_warnings_checker(log_level, log_levels): """Whitelist for browser console errors and its assert.""" assert_that( log_level["message"], any_of( contains_string(cnst.INVALID_PROP_ERROR), contains_string(cnst.REACT_NOT_RECOGNIZE_ERROR), contai...
Whitelist for browser console errors and its assert.
browser_console_warnings_checker
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/checkers.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/checkers.py
Apache-2.0
def check_graph_is_loading_selenium(driver, graph_id, timeout=cnst.SELENIUM_WAITERS_TIMEOUT): """Waiting for graph to start reloading for pure selenium.""" WebDriverWait(driver, timeout).until( expected_conditions.presence_of_element_located( (By.CSS_SELECTOR, f"div[id='{graph_id}'][data-das...
Waiting for graph to start reloading for pure selenium.
check_graph_is_loading_selenium
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/checkers.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/checkers.py
Apache-2.0
def check_selected_categorical_component(driver, component_id, options_value_status): """Checks what selected and what is not for checklist and radio items. Args: driver: dash_br fixture component_id: id of checklist or radio items options_value_status: list of dicts with the next synta...
Checks what selected and what is not for checklist and radio items. Args: driver: dash_br fixture component_id: id of checklist or radio items options_value_status: list of dicts with the next syntax [{ "value": int, number of the value inside dom structure, ...
check_selected_categorical_component
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/checkers.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/checkers.py
Apache-2.0
def accordion_select(driver, accordion_name): """Selecting accordion and checking if it is active.""" accordion_name = accordion_name.upper() click_element_by_xpath_selenium(driver, f"//button[text()='{accordion_name}']") check_accordion_active(driver, accordion_name) # to let accordion open tim...
Selecting accordion and checking if it is active.
accordion_select
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/navigation.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/navigation.py
Apache-2.0
def page_select(driver, page_name, graph_check=True, page_path=None): """Selecting page and checking if it has proper title.""" page_path = page_path if page_path else f"/{page_name}" driver.multiple_click(f"a[href='{page_path}']", 1) driver.wait_for_contains_text(page_title_path(), page_name) if g...
Selecting page and checking if it has proper title.
page_select
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/navigation.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/navigation.py
Apache-2.0
def page_select_selenium(driver, page_path, page_name, timeout=cnst.SELENIUM_WAITERS_TIMEOUT, graph_check=True): """Selecting page and checking if it has proper title for pure selenium.""" WebDriverWait(driver, timeout).until( expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, f"a[href='{page...
Selecting page and checking if it has proper title for pure selenium.
page_select_selenium
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/navigation.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/navigation.py
Apache-2.0
def select_dropdown_value(driver, value, dropdown_id, multi=True): """Steps to select value in dropdown.""" dropdown_path = f"div[id='{dropdown_id}']" if multi: driver.multiple_click(f"{dropdown_path} .Select-clear", 1) driver.multiple_click(f"{dropdown_path} .Select-arrow", 1) driver.multip...
Steps to select value in dropdown.
select_dropdown_value
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/navigation.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/navigation.py
Apache-2.0
def graph_load_waiter_selenium(driver, graph_id, timeout=cnst.SELENIUM_WAITERS_TIMEOUT): """Waiting for graph's x-axis to appear for pure selenium.""" WebDriverWait(driver, timeout).until( expected_conditions.presence_of_element_located( (By.CSS_SELECTOR, f"div[id='{graph_id}'] path[class='x...
Waiting for graph's x-axis to appear for pure selenium.
graph_load_waiter_selenium
python
mckinsey/vizro
vizro-core/tests/tests_utils/e2e/vizro/waiters.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/tests_utils/e2e/vizro/waiters.py
Apache-2.0
def managers_one_page_two_graphs_with_dynamic_data(box_chart_dynamic_data_frame, scatter_chart_dynamic_data_frame): """Instantiates a simple model_manager and data_manager with a page, two graph models and the button component.""" vm.Page( id="test_page", title="My first dashboard", comp...
Instantiates a simple model_manager and data_manager with a page, two graph models and the button component.
managers_one_page_two_graphs_with_dynamic_data
python
mckinsey/vizro
vizro-core/tests/unit/vizro/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/conftest.py
Apache-2.0
def page_actions_builtin_controls(standard_px_chart): """Instantiates managers with one page that contains filter, parameter, and filter_interaction actions.""" vm.Page( title="title", components=[ vm.Graph( id="graph_1", figure=standard_px_chart, ...
Instantiates managers with one page that contains filter, parameter, and filter_interaction actions.
page_actions_builtin_controls
python
mckinsey/vizro
vizro-core/tests/unit/vizro/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/conftest.py
Apache-2.0
def manager_for_testing_actions_output_input_prop(ag_grid_with_id): """Instantiates the model_manager using a Dropdown (has default input and output properties).""" # We have to use one of the selectors as the known-model as currently only the selectors have both # input and output properties defined. There...
Instantiates the model_manager using a Dropdown (has default input and output properties).
manager_for_testing_actions_output_input_prop
python
mckinsey/vizro
vizro-core/tests/unit/vizro/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/conftest.py
Apache-2.0
def managers_one_page_two_graphs_one_button(box_chart, scatter_chart): """Instantiates a simple model_manager and data_manager with a page, two graph models and the button component.""" vm.Page( id="test_page", title="My first dashboard", components=[ vm.Graph(id="box_chart",...
Instantiates a simple model_manager and data_manager with a page, two graph models and the button component.
managers_one_page_two_graphs_one_button
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/conftest.py
Apache-2.0
def managers_one_page_two_graphs_one_table_one_aggrid_one_button( box_chart, scatter_chart, dash_data_table_with_id, ag_grid_with_id ): """Instantiates a simple model_manager and data_manager with: page, graphs, table, aggrid and button component.""" vm.Page( id="test_page", title="My first ...
Instantiates a simple model_manager and data_manager with: page, graphs, table, aggrid and button component.
managers_one_page_two_graphs_one_table_one_aggrid_one_button
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/conftest.py
Apache-2.0
def managers_one_page_one_graph_with_dict_param_input(scatter_matrix_chart): """Instantiates a model_manager and data_manager with a page and a graph that requires a list input.""" vm.Page( id="test_page", title="My first dashboard", components=[ vm.Graph(id="scatter_matrix_c...
Instantiates a model_manager and data_manager with a page and a graph that requires a list input.
managers_one_page_one_graph_with_dict_param_input
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/conftest.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/conftest.py
Apache-2.0
def ctx_export_data(request): """Mock dash.ctx that represents filters and filter interactions applied.""" targets, pop_filter, continent_filter_interaction, country_table_filter_interaction = request.param args_grouping_filter_interaction = [] if continent_filter_interaction: args_grouping_filt...
Mock dash.ctx that represents filters and filter interactions applied.
ctx_export_data
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_export_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_export_data.py
Apache-2.0
def ctx_export_data_filter_and_parameter(request): """Mock dash.ctx that represents filters and parameter applied.""" targets, pop_filter, first_n_parameter = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filters": ( ...
Mock dash.ctx that represents filters and parameter applied.
ctx_export_data_filter_and_parameter
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_export_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_export_data.py
Apache-2.0
def config_for_testing_all_components_with_actions(request, standard_px_chart, ag_grid_with_id): """Instantiates managers with one page that contains four controls, two graphs and filter interaction.""" # If the fixture is parametrised set the targets. Otherwise, set export_data without targets. export_data...
Instantiates managers with one page that contains four controls, two graphs and filter interaction.
config_for_testing_all_components_with_actions
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_export_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_export_data.py
Apache-2.0
def ctx_filter_continent(request): """Mock dash.ctx that represents continent Filter value selection.""" continent = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filters": [ ...
Mock dash.ctx that represents continent Filter value selection.
ctx_filter_continent
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_filter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_filter_action.py
Apache-2.0
def ctx_filter_continent_and_pop(request): """Mock dash.ctx that represents continent and pop Filter value selection.""" continent, pop = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], ...
Mock dash.ctx that represents continent and pop Filter value selection.
ctx_filter_continent_and_pop
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_filter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_filter_action.py
Apache-2.0
def ctx_filter_interaction(request): """Mock dash.ctx that represents a click on a continent data-point and table selected cell.""" continent_filter_interaction, country_table_filter_interaction, country_aggrid_filter_interaction = request.param args_grouping_filter_interaction = [] if continent_filter...
Mock dash.ctx that represents a click on a continent data-point and table selected cell.
ctx_filter_interaction
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_filter_interaction.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_filter_interaction.py
Apache-2.0
def ctx_export_data(request): """Mock dash.ctx that represents filters and filter interactions applied.""" targets, pop_filter, continent_filter_interaction, country_table_filter_interaction = request.param args_grouping_filter_interaction = [] if continent_filter_interaction: args_grouping_filt...
Mock dash.ctx that represents filters and filter interactions applied.
ctx_export_data
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_legacy_export_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_legacy_export_data.py
Apache-2.0
def ctx_export_data_filter_and_parameter(request): """Mock dash.ctx that represents filters and parameter applied.""" targets, pop_filter, first_n_parameter = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filters": ( ...
Mock dash.ctx that represents filters and parameter applied.
ctx_export_data_filter_and_parameter
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_legacy_export_data.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_legacy_export_data.py
Apache-2.0
def ctx_filter_interaction(request): """Mock dash.ctx that represents a click on a continent data-point and table selected cell.""" continent_filter_interaction, country_table_filter_interaction, country_aggrid_filter_interaction = request.param args_grouping_filter_interaction = [] if continent_filter...
Mock dash.ctx that represents a click on a continent data-point and table selected cell.
ctx_filter_interaction
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_legacy_filter_interaction.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_legacy_filter_interaction.py
Apache-2.0
def ctx_on_page_load(request): """Mock dash.ctx that represents on page load.""" continent_filter, pop, y, x = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filters": [ ...
Mock dash.ctx that represents on page load.
ctx_on_page_load
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_on_page_load.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_on_page_load.py
Apache-2.0
def ctx_parameter_y(request): """Mock dash.ctx that represents y-axis Parameter value selection.""" y = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filters": [], ...
Mock dash.ctx that represents y-axis Parameter value selection.
ctx_parameter_y
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_parameter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_parameter_action.py
Apache-2.0
def ctx_parameter_dimensions(request): """Mock dash.ctx that represents `dimensions` Parameter value selection.""" y = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filters": [...
Mock dash.ctx that represents `dimensions` Parameter value selection.
ctx_parameter_dimensions
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_parameter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_parameter_action.py
Apache-2.0
def ctx_parameter_hover_data(request): """Mock dash.ctx that represents hover_data Parameter value selection.""" hover_data = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filt...
Mock dash.ctx that represents hover_data Parameter value selection.
ctx_parameter_hover_data
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_parameter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_parameter_action.py
Apache-2.0
def ctx_parameter_y_and_x(request): """Mock dash.ctx that represents y-axis Parameter value selection.""" y, x = request.param mock_ctx = { "args_grouping": { "external": { "_controls": { "filter_interaction": [], "filters": [], ...
Mock dash.ctx that represents y-axis Parameter value selection.
ctx_parameter_y_and_x
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_parameter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_parameter_action.py
Apache-2.0
def ctx_parameter_data_frame_argument(request): """Mock dash.ctx that represents parameter applied.""" targets, first_n_last_n_args = request.param dynamic_filters = [] parameters = [ CallbackTriggerDict( id="first_n_parameter", property="value", value=first_...
Mock dash.ctx that represents parameter applied.
ctx_parameter_data_frame_argument
python
mckinsey/vizro
vizro-core/tests/unit/vizro/actions/test_parameter_action.py
https://github.com/mckinsey/vizro/blob/master/vizro-core/tests/unit/vizro/actions/test_parameter_action.py
Apache-2.0