Coverage for src/ipyvizzustory/ipy_env/story.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-23 18:23 +0100

1"""A module for working with ipyvizzu-story presentations.""" 

2 

3from typing import Optional 

4 

5from IPython.display import display as display_html, HTML # type: ignore 

6 

7from ipyvizzu import Data, Style 

8 

9from ipyvizzustory.storylib.story import Story as StoryLib 

10 

11 

12class Story(StoryLib): 

13 """A class for representing a presentation story in Jupyter environment.""" 

14 

15 def __init__(self, data: Data, style: Optional[Style] = None): 

16 super().__init__(data=data, style=style) 

17 

18 def _repr_html_(self) -> str: 

19 return self.to_html() 

20 

21 def play(self) -> None: 

22 """A method for displaying the html code.""" 

23 

24 display_html(HTML(self.to_html()))