reflex/tests/components/graphing/test_recharts.py
Elijah Ahianyo 34bf25071a
[REF-2821]Improve Dynamic Imports (#3345)
* Improve import times

* add lazy loading to rx.el

* add lazy loading to reflex core components

* minor refactor

* Get imports working with reflex web

* get imports to work with all reflex examples

* refactor to define imports only in the root.

* lint

* deadcode remove

* update poetry deps

* unit tests fix

* app_harness fix

* app_harness fix

* pyi file generate

* pyi file generate

* sort pyi order

* fix pyi

* fix docker ci

* rework pyi-generator

* generate pyi for __init__ files

* test pyright

* test pyright ci

* partial pyright fix

* more pyright fix

* pyright fix

* fix pyi_generator

* add rx.serializer and others

* add future annotation import which fixes container CI, then also load recharts lazily

* add new pyi files

* pyright fix

* minor fixes for reflex-web and flexdown

* forward references for py38

* ruff fix

* pyi fix

* unit tests fix

* reduce coverage to 68%

* reduce coverage to 67%

* reduce coverage to 66%as a workaround to coverage's rounding issue

* reduce coverage to 66%as a workaround to coverage's rounding issue

* exclude lazy_loader dependency review checks.

* its lazy-loader

* Add docstrings and regenerate pyi files

* add link

* address Pr comments

* CI fix

* partially address PR comments.

* edit docstrings and fix integration tests

* fix typo in docstring

* pyi fix
2024-05-31 16:43:10 +00:00

53 lines
1.3 KiB
Python

from reflex.components.recharts.charts import (
AreaChart,
BarChart,
LineChart,
PieChart,
RadarChart,
RadialBarChart,
ScatterChart,
)
from reflex.components.recharts.general import ResponsiveContainer
def test_area_chart():
ac = AreaChart.create()
assert isinstance(ac, ResponsiveContainer)
assert isinstance(ac.children[0], AreaChart)
def test_bar_chart():
bc = BarChart.create()
assert isinstance(bc, ResponsiveContainer)
assert isinstance(bc.children[0], BarChart)
def test_line_chart():
lc = LineChart.create()
assert isinstance(lc, ResponsiveContainer)
assert isinstance(lc.children[0], LineChart)
def test_pie_chart():
pc = PieChart.create()
assert isinstance(pc, ResponsiveContainer)
assert isinstance(pc.children[0], PieChart)
def test_radar_chart():
rc = RadarChart.create()
assert isinstance(rc, ResponsiveContainer)
assert isinstance(rc.children[0], RadarChart)
def test_radial_bar_chart():
rbc = RadialBarChart.create()
assert isinstance(rbc, ResponsiveContainer)
assert isinstance(rbc.children[0], RadialBarChart)
def test_scatter_chart():
sc = ScatterChart.create()
assert isinstance(sc, ResponsiveContainer)
assert isinstance(sc.children[0], ScatterChart)