flet 0.70.0.dev5771__py3-none-any.whl → 0.70.0.dev5776__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flet might be problematic. Click here for more details.

Files changed (65) hide show
  1. flet/controls/control.py +12 -6
  2. flet/controls/core/animated_switcher.py +3 -2
  3. flet/controls/core/autofill_group.py +6 -2
  4. flet/controls/core/dismissible.py +12 -10
  5. flet/controls/core/drag_target.py +3 -2
  6. flet/controls/core/draggable.py +9 -9
  7. flet/controls/core/icon.py +16 -12
  8. flet/controls/core/interactive_viewer.py +24 -23
  9. flet/controls/core/pagelet.py +3 -2
  10. flet/controls/core/reorderable_draggable.py +3 -2
  11. flet/controls/core/safe_area.py +3 -2
  12. flet/controls/core/text_span.py +5 -3
  13. flet/controls/core/window_drag_area.py +3 -2
  14. flet/controls/cupertino/cupertino_action_sheet.py +10 -5
  15. flet/controls/cupertino/cupertino_action_sheet_action.py +3 -4
  16. flet/controls/cupertino/cupertino_activity_indicator.py +4 -3
  17. flet/controls/cupertino/cupertino_alert_dialog.py +6 -3
  18. flet/controls/cupertino/cupertino_button.py +6 -5
  19. flet/controls/cupertino/cupertino_context_menu.py +8 -4
  20. flet/controls/cupertino/cupertino_context_menu_action.py +3 -4
  21. flet/controls/cupertino/cupertino_date_picker.py +44 -28
  22. flet/controls/cupertino/cupertino_dialog_action.py +3 -4
  23. flet/controls/cupertino/cupertino_list_tile.py +3 -4
  24. flet/controls/cupertino/cupertino_navigation_bar.py +6 -5
  25. flet/controls/cupertino/cupertino_picker.py +14 -10
  26. flet/controls/cupertino/cupertino_segmented_button.py +6 -5
  27. flet/controls/cupertino/cupertino_slider.py +16 -12
  28. flet/controls/cupertino/cupertino_sliding_segmented_button.py +6 -5
  29. flet/controls/cupertino/cupertino_timer_picker.py +38 -31
  30. flet/controls/material/alert_dialog.py +6 -5
  31. flet/controls/material/app_bar.py +17 -14
  32. flet/controls/material/banner.py +13 -11
  33. flet/controls/material/bottom_app_bar.py +5 -4
  34. flet/controls/material/bottom_sheet.py +5 -4
  35. flet/controls/material/button.py +12 -4
  36. flet/controls/material/chip.py +13 -12
  37. flet/controls/material/circle_avatar.py +17 -13
  38. flet/controls/material/datatable.py +48 -41
  39. flet/controls/material/divider.py +24 -14
  40. flet/controls/material/dropdown.py +5 -3
  41. flet/controls/material/expansion_tile.py +11 -22
  42. flet/controls/material/floating_action_button.py +32 -23
  43. flet/controls/material/icon_button.py +7 -3
  44. flet/controls/material/navigation_rail.py +14 -11
  45. flet/controls/material/outlined_button.py +7 -3
  46. flet/controls/material/progress_bar.py +18 -10
  47. flet/controls/material/radio_group.py +5 -1
  48. flet/controls/material/range_slider.py +13 -13
  49. flet/controls/material/segmented_button.py +21 -17
  50. flet/controls/material/selection_area.py +3 -2
  51. flet/controls/material/slider.py +16 -12
  52. flet/controls/material/snack_bar.py +18 -10
  53. flet/controls/material/switch.py +6 -5
  54. flet/controls/material/tabs.py +18 -14
  55. flet/controls/material/textfield.py +22 -14
  56. flet/controls/material/vertical_divider.py +14 -12
  57. flet/controls/page.py +2 -1
  58. flet/testing/finder.py +2 -0
  59. flet/testing/flet_test_app.py +2 -0
  60. flet/version.py +1 -1
  61. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/METADATA +5 -5
  62. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/RECORD +65 -65
  63. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/WHEEL +0 -0
  64. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/entry_points.txt +0 -0
  65. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/top_level.txt +0 -0
@@ -23,7 +23,7 @@ class CupertinoNavigationBar(LayoutControl):
23
23
  destinations in an app.
24
24
 
25
25
  Raises:
26
- AssertionError: If [`destinations`][(c).] does not contain at least two visible
26
+ ValueError: If [`destinations`][(c).] does not contain at least two visible
27
27
  [`NavigationBarDestination`][flet.]s.
28
28
  IndexError: If [`selected_index`][(c).] is out of range.
29
29
  """
@@ -80,10 +80,11 @@ class CupertinoNavigationBar(LayoutControl):
80
80
  def before_update(self):
81
81
  super().before_update()
82
82
  visible_destinations_count = len([d for d in self.destinations if d.visible])
83
- assert visible_destinations_count >= 2, (
84
- f"destinations must contain at minimum two visible controls, "
85
- f"got {visible_destinations_count}"
86
- )
83
+ if visible_destinations_count < 2:
84
+ raise ValueError(
85
+ f"destinations must contain at minimum two visible controls, "
86
+ f"got {visible_destinations_count}"
87
+ )
87
88
  if not (0 <= self.selected_index < visible_destinations_count):
88
89
  raise IndexError(
89
90
  f"selected_index ({self.selected_index}) is out of range. "
@@ -20,7 +20,7 @@ class CupertinoPicker(LayoutControl):
20
20
  An iOS-styled picker.
21
21
 
22
22
  Raises:
23
- AssertionError: If [`item_extent`][(c).], [`squeeze`][(c).],
23
+ ValueError: If [`item_extent`][(c).], [`squeeze`][(c).],
24
24
  or [`magnification`][(c).] is not strictly greater than `0.0`.
25
25
  """
26
26
 
@@ -104,12 +104,16 @@ class CupertinoPicker(LayoutControl):
104
104
 
105
105
  def before_update(self):
106
106
  super().before_update()
107
- assert self.squeeze > 0.0, (
108
- f"squeeze must be strictly greater than 0.0, got {self.squeeze}"
109
- )
110
- assert self.magnification > 0.0, (
111
- f"magnification must be strictly greater than 0.0, got {self.magnification}"
112
- )
113
- assert self.item_extent > 0.0, (
114
- f"item_extent must be strictly greater than 0.0, got {self.item_extent}"
115
- )
107
+ if self.squeeze <= 0.0:
108
+ raise ValueError(
109
+ f"squeeze must be strictly greater than 0.0, got {self.squeeze}"
110
+ )
111
+ if self.magnification <= 0.0:
112
+ raise ValueError(
113
+ f"magnification must be strictly greater than 0.0, "
114
+ f"got {self.magnification}"
115
+ )
116
+ if self.item_extent <= 0.0:
117
+ raise ValueError(
118
+ f"item_extent must be strictly greater than 0.0, got {self.item_extent}"
119
+ )
@@ -16,7 +16,7 @@ class CupertinoSegmentedButton(LayoutControl):
16
16
  An iOS-style segmented button.
17
17
 
18
18
  Raises:
19
- AssertionError: If [`controls`][(c).] does not contain at least two visible
19
+ ValueError: If [`controls`][(c).] does not contain at least two visible
20
20
  controls.
21
21
  IndexError: If [`selected_index`][(c).] is out of range.
22
22
  """
@@ -88,10 +88,11 @@ class CupertinoSegmentedButton(LayoutControl):
88
88
  def before_update(self):
89
89
  super().before_update()
90
90
  visible_controls_count = len([c for c in self.controls if c.visible])
91
- assert visible_controls_count >= 2, (
92
- f"controls must contain at minimum two visible Controls, "
93
- f"got {visible_controls_count}"
94
- )
91
+ if visible_controls_count < 2:
92
+ raise ValueError(
93
+ f"controls must contain at minimum two visible Controls, "
94
+ f"got {visible_controls_count}"
95
+ )
95
96
  if not (0 <= self.selected_index < visible_controls_count):
96
97
  raise IndexError(
97
98
  f"selected_index ({self.selected_index}) is out of range. "
@@ -24,9 +24,9 @@ class CupertinoSlider(LayoutControl):
24
24
  setting changes.
25
25
 
26
26
  Raises:
27
- AssertionError: If [`min`][(c).] is greater than or equal to [`max`][(c).].
28
- AssertionError: If [`min`][(c).] is greater than or equal to [`value`][(c).].
29
- AssertionError: If [`max`][(c).] is less than or equal to [`value`][(c).].
27
+ ValueError: If [`min`][(c).] is greater than [`max`][(c).].
28
+ ValueError: If [`value`][(c).] is less than [`min`][(c).].
29
+ ValueError: If [`value`][(c).] is greater than [`max`][(c).].
30
30
  """
31
31
 
32
32
  value: Optional[Number] = None
@@ -102,12 +102,16 @@ class CupertinoSlider(LayoutControl):
102
102
  def before_update(self):
103
103
  super().before_update()
104
104
  self.value = self.value if self.value is not None else self.min
105
- assert self.min <= self.max, (
106
- f"min ({self.min}) must be less than or equal to max ({self.max})"
107
- )
108
- assert self.value is None or (self.value >= self.min), (
109
- f"value ({self.value}) must be greater than or equal to min ({self.min})"
110
- )
111
- assert self.value is None or (self.value <= self.max), (
112
- f"value ({self.value}) must be less than or equal to max ({self.max})"
113
- )
105
+ if self.min > self.max:
106
+ raise ValueError(
107
+ f"min ({self.min}) must be less than or equal to max ({self.max})"
108
+ )
109
+ if self.value is not None and self.value < self.min:
110
+ raise ValueError(
111
+ f"value ({self.value}) must be greater than or "
112
+ f"equal to min ({self.min})"
113
+ )
114
+ if self.value is not None and self.value > self.max:
115
+ raise ValueError(
116
+ f"value ({self.value}) must be less than or equal to max ({self.max})"
117
+ )
@@ -20,7 +20,7 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
20
20
  A cupertino sliding segmented button.
21
21
 
22
22
  Raises:
23
- AssertionError: If [`controls`][(c).] does not contain at least two
23
+ ValueError: If [`controls`][(c).] does not contain at least two
24
24
  visible controls.
25
25
  IndexError: If [`selected_index`][(c).] is out of range.
26
26
  """
@@ -78,10 +78,11 @@ class CupertinoSlidingSegmentedButton(LayoutControl):
78
78
  def before_update(self):
79
79
  super().before_update()
80
80
  visible_controls_count = len([c for c in self.controls if c.visible])
81
- assert visible_controls_count >= 2, (
82
- f"controls must contain at minimum two visible Controls, "
83
- f"got {visible_controls_count}"
84
- )
81
+ if visible_controls_count < 2:
82
+ raise ValueError(
83
+ f"controls must contain at minimum two visible Controls, "
84
+ f"got {visible_controls_count}"
85
+ )
85
86
  if not (0 <= self.selected_index < visible_controls_count):
86
87
  raise IndexError(
87
88
  f"selected_index ({self.selected_index}) is out of range. "
@@ -27,17 +27,17 @@ class CupertinoTimerPicker(LayoutControl):
27
27
  duration is bound between `0` and `23` hours `59` minutes `59` seconds.
28
28
 
29
29
  Raises:
30
- AssertionError: If [`value`][(c).] is negative.
31
- AssertionError: If [`value`][(c).] is 24 hours or more.
32
- AssertionError: If [`minute_interval`][(c).] is not a positive integer
30
+ ValueError: If [`value`][(c).] is negative.
31
+ ValueError: If [`value`][(c).] is 24 hours or more.
32
+ ValueError: If [`minute_interval`][(c).] is not a positive integer
33
33
  factor of `60`.
34
- AssertionError: If [`second_interval`][(c).] is not a positive integer
34
+ ValueError: If [`second_interval`][(c).] is not a positive integer
35
35
  factor of `60`.
36
- AssertionError: If [`value`][(c).] is not a multiple
36
+ ValueError: If [`value`][(c).] is not a multiple
37
37
  of [`minute_interval`][(c).].
38
- AssertionError: If [`value`][(c).] is not a multiple
38
+ ValueError: If [`value`][(c).] is not a multiple
39
39
  of [`second_interval`][(c).].
40
- AssertionError: If [`item_extent`][(c).] is not strictly greater than `0.0`.
40
+ ValueError: If [`item_extent`][(c).] is not strictly greater than `0.0`.
41
41
  """
42
42
 
43
43
  value: DurationValue = field(default_factory=lambda: Duration())
@@ -95,32 +95,39 @@ class CupertinoTimerPicker(LayoutControl):
95
95
 
96
96
  def before_update(self):
97
97
  super().before_update()
98
- # normalize for use in below assertion checks
98
+ # normalize for use in below validation checks
99
99
  value = (
100
100
  self.value
101
101
  if isinstance(self.value, Duration)
102
102
  else Duration(seconds=self.value)
103
103
  )
104
- assert value >= Duration(), "value must be a non-negative duration"
105
- assert value < Duration(hours=24), (
106
- f"value must be strictly less than 24 hours, got {value.in_hours} hours"
107
- )
108
- assert self.minute_interval > 0 and 60 % self.minute_interval == 0, (
109
- f"minute_interval ({self.minute_interval}) must be a positive "
110
- "integer factor of 60"
111
- )
112
- assert self.second_interval > 0 and 60 % self.second_interval == 0, (
113
- f"second_interval ({self.second_interval}) must be a positive "
114
- "integer factor of 60"
115
- )
116
- assert value.in_minutes % self.minute_interval == 0, (
117
- f"value ({value.in_minutes} minutes) must be a multiple "
118
- f"of minute_interval ({self.minute_interval})"
119
- )
120
- assert value.in_seconds % self.second_interval == 0, (
121
- f"value ({value.in_seconds} seconds) must be a multiple "
122
- f"of second_interval ({self.second_interval})"
123
- )
124
- assert self.item_extent > 0, (
125
- f"item_extent must be strictly greater than 0.0, got {self.item_extent}"
126
- )
104
+ if value < Duration():
105
+ raise ValueError("value must be a non-negative duration")
106
+ if value >= Duration(hours=24):
107
+ raise ValueError(
108
+ f"value must be strictly less than 24 hours, got {value.in_hours} hours"
109
+ )
110
+ if not (self.minute_interval > 0 and 60 % self.minute_interval == 0):
111
+ raise ValueError(
112
+ f"minute_interval ({self.minute_interval}) must be a positive "
113
+ "integer factor of 60"
114
+ )
115
+ if not (self.second_interval > 0 and 60 % self.second_interval == 0):
116
+ raise ValueError(
117
+ f"second_interval ({self.second_interval}) must be a positive "
118
+ "integer factor of 60"
119
+ )
120
+ if value.in_minutes % self.minute_interval != 0:
121
+ raise ValueError(
122
+ f"value ({value.in_minutes} minutes) must be a multiple "
123
+ f"of minute_interval ({self.minute_interval})"
124
+ )
125
+ if value.in_seconds % self.second_interval != 0:
126
+ raise ValueError(
127
+ f"value ({value.in_seconds} seconds) must be a multiple "
128
+ f"of second_interval ({self.second_interval})"
129
+ )
130
+ if self.item_extent <= 0:
131
+ raise ValueError(
132
+ f"item_extent must be strictly greater than 0.0, got {self.item_extent}"
133
+ )
@@ -29,7 +29,7 @@ class AlertDialog(DialogControl):
29
29
  below the `content`.
30
30
 
31
31
  Raises:
32
- AssertionError: If none of [`title`][(c).], [`content`][(c).], or
32
+ ValueError: If none of [`title`][(c).], [`content`][(c).], or
33
33
  [`actions`][(c).] are provided, as the dialog would have nothing to display.
34
34
  """
35
35
 
@@ -230,7 +230,8 @@ class AlertDialog(DialogControl):
230
230
 
231
231
  def before_update(self):
232
232
  super().before_update()
233
- assert self.title or self.content or self.actions, (
234
- "AlertDialog has nothing to display. Provide at minimum one of the "
235
- "following: title, content, actions"
236
- )
233
+ if not (self.title or self.content or self.actions):
234
+ raise ValueError(
235
+ "AlertDialog has nothing to display. Provide at minimum one of the "
236
+ "following: title, content, actions"
237
+ )
@@ -20,9 +20,9 @@ class AppBar(AdaptiveControl):
20
20
  A material design app bar.
21
21
 
22
22
  Raises:
23
- AssertionError: If [`elevation`][(c).] or [`elevation_on_scroll`][(c).]
24
- is negative.
25
- AssertionError: If [`toolbar_opacity`][(c).] is not between `0.0`
23
+ ValueError: If [`elevation`][(c).] is negative.
24
+ ValueError: If [`elevation_on_scroll`][(c).] is negative.
25
+ ValueError: If [`toolbar_opacity`][(c).] is not between `0.0`
26
26
  and `1.0` inclusive.
27
27
  """
28
28
 
@@ -193,14 +193,17 @@ class AppBar(AdaptiveControl):
193
193
 
194
194
  def before_update(self):
195
195
  super().before_update()
196
- assert self.elevation is None or self.elevation >= 0, (
197
- f"elevation must be greater than or equal to 0, got {self.elevation}"
198
- )
199
- assert self.elevation_on_scroll is None or self.elevation_on_scroll >= 0, (
200
- "elevation_on_scroll must be greater than or equal to 0, "
201
- f"got {self.elevation_on_scroll}"
202
- )
203
- assert 0 <= self.toolbar_opacity <= 1, (
204
- "toolbar_opacity must be between 0.0 and 1.0 inclusive, "
205
- f"got {self.toolbar_opacity}"
206
- )
196
+ if self.elevation is not None and self.elevation < 0:
197
+ raise ValueError(
198
+ f"elevation must be greater than or equal to 0, got {self.elevation}"
199
+ )
200
+ if self.elevation_on_scroll is not None and self.elevation_on_scroll < 0:
201
+ raise ValueError(
202
+ "elevation_on_scroll must be greater than or equal to 0, "
203
+ f"got {self.elevation_on_scroll}"
204
+ )
205
+ if not (0 <= self.toolbar_opacity <= 1):
206
+ raise ValueError(
207
+ "toolbar_opacity must be between 0.0 and 1.0 inclusive, "
208
+ f"got {self.toolbar_opacity}"
209
+ )
@@ -28,9 +28,9 @@ class Banner(DialogControl):
28
28
  them at any time.
29
29
 
30
30
  Raises:
31
- AssertionError: if [`content`][(c).] is not visible.
32
- AssertionError: if [`elevation`][(c).] is negative.
33
- AssertionError: if [`actions`][(c).] does not contain at least one visible
31
+ ValueError: if [`content`][(c).] is not visible.
32
+ ValueError: if [`elevation`][(c).] is negative.
33
+ ValueError: if [`actions`][(c).] does not contain at least one visible
34
34
  action Control.
35
35
  """
36
36
 
@@ -128,11 +128,13 @@ class Banner(DialogControl):
128
128
 
129
129
  def before_update(self):
130
130
  super().before_update()
131
- assert self.elevation is None or self.elevation >= 0, (
132
- f"elevation must be greater than or equal to 0, got {self.elevation}"
133
- )
134
- if isinstance(self.content, Control):
135
- assert self.content.visible, "content must be visible"
136
- assert any(a.visible for a in self.actions), (
137
- "actions must contain at minimum one visible action Control"
138
- )
131
+ if self.elevation is not None and self.elevation < 0:
132
+ raise ValueError(
133
+ f"elevation must be greater than or equal to 0, got {self.elevation}"
134
+ )
135
+ if isinstance(self.content, Control) and not self.content.visible:
136
+ raise ValueError("content must be visible")
137
+ if not any(a.visible for a in self.actions):
138
+ raise ValueError(
139
+ "actions must contain at minimum one visible action Control"
140
+ )
@@ -20,7 +20,7 @@ class BottomAppBar(LayoutControl):
20
20
  A material design bottom app bar.
21
21
 
22
22
  Raises:
23
- AssertionError: If [`elevation`][(c).] is negative.
23
+ ValueError: If [`elevation`][(c).] is negative.
24
24
  """
25
25
 
26
26
  content: Optional[Control] = None
@@ -74,6 +74,7 @@ class BottomAppBar(LayoutControl):
74
74
 
75
75
  def before_update(self):
76
76
  super().before_update()
77
- assert self.elevation is None or self.elevation >= 0, (
78
- f"elevation must be greater than or equal to 0, got {self.elevation}"
79
- )
77
+ if self.elevation is not None and self.elevation < 0:
78
+ raise ValueError(
79
+ f"elevation must be greater than or equal to 0, got {self.elevation}"
80
+ )
@@ -20,7 +20,7 @@ class BottomSheet(DialogControl):
20
20
  from interacting with the rest of the app.
21
21
 
22
22
  Raises:
23
- AssertionError: If [`elevation`][(c).] is negative.
23
+ ValueError: If [`elevation`][(c).] is negative.
24
24
  """
25
25
 
26
26
  content: Control
@@ -99,6 +99,7 @@ class BottomSheet(DialogControl):
99
99
 
100
100
  def before_update(self):
101
101
  super().before_update()
102
- assert self.elevation is None or self.elevation >= 0, (
103
- f"elevation must be greater than or equal to zero, got {self.elevation}"
104
- )
102
+ if self.elevation is not None and self.elevation < 0:
103
+ raise ValueError(
104
+ f"elevation must be greater than or equal to zero, got {self.elevation}"
105
+ )
@@ -22,9 +22,14 @@ __all__ = ["Button"]
22
22
  @control("Button")
23
23
  class Button(LayoutControl, AdaptiveControl):
24
24
  """
25
- A customizable button control that can display text, icons, or both.
25
+ A material button.
26
26
 
27
- It supports various styles, colors, and event handlers for user interaction.
27
+ It supports various styles, colors, event handlers for user interaction,
28
+ and can be used to display text, icons, etc.
29
+
30
+ Raises:
31
+ ValueError: If neither [`icon`][(c).] nor [`content`][(c).]
32
+ (string or visible control) is provided.
28
33
  """
29
34
 
30
35
  content: Optional[StrOrControl] = None
@@ -45,11 +50,14 @@ class Button(LayoutControl, AdaptiveControl):
45
50
 
46
51
  def before_update(self):
47
52
  super().before_update()
48
- assert (
53
+ if not (
49
54
  self.icon
50
55
  or isinstance(self.content, str)
51
56
  or (isinstance(self.content, Control) and self.content.visible)
52
- ), "At least icon or content (string or visible Control) must be provided"
57
+ ):
58
+ raise ValueError(
59
+ "At least icon or content (string or visible Control) must be provided"
60
+ )
53
61
 
54
62
  if (
55
63
  self.style is not None
@@ -28,9 +28,9 @@ class Chip(LayoutControl):
28
28
  Chips are compact elements that represent an attribute, text, entity, or action.
29
29
 
30
30
  Raises:
31
- AssertionError: If [`elevation`][(c).] or [`elevation_on_click`][(c).] is
31
+ ValueError: If [`elevation`][(c).] or [`elevation_on_click`][(c).] is
32
32
  negative.
33
- AssertionError: If callback for both [`on_click`][(c).] and [`on_select`][(c).]
33
+ ValueError: If callback for both [`on_click`][(c).] and [`on_select`][(c).]
34
34
  are specified.
35
35
  """
36
36
 
@@ -254,13 +254,14 @@ class Chip(LayoutControl):
254
254
 
255
255
  def before_update(self):
256
256
  super().before_update()
257
- assert self.on_select is None or self.on_click is None, (
258
- "on_select and on_click cannot be used together"
259
- )
260
- assert self.elevation is None or self.elevation >= 0.0, (
261
- f"elevation must be greater than or equal to 0, got {self.elevation}"
262
- )
263
- assert self.elevation_on_click is None or self.elevation_on_click >= 0.0, (
264
- "elevation_on_click must be greater than or equal to 0, got "
265
- "{self.elevation_on_click}"
266
- )
257
+ if self.on_select is not None and self.on_click is not None:
258
+ raise ValueError("on_select and on_click cannot be used together")
259
+ if self.elevation is not None and self.elevation < 0.0:
260
+ raise ValueError(
261
+ f"elevation must be greater than or equal to 0, got {self.elevation}"
262
+ )
263
+ if self.elevation_on_click is not None and self.elevation_on_click < 0.0:
264
+ raise ValueError(
265
+ "elevation_on_click must be greater than or equal to 0, got "
266
+ f"{self.elevation_on_click}"
267
+ )
@@ -21,9 +21,9 @@ class CircleAvatar(LayoutControl):
21
21
  and if this also fails, then [`bgcolor`][(c).] is used.
22
22
 
23
23
  Raises:
24
- AssertionError: If [`radius`][(c).] or [`min_radius`][(c).]
24
+ ValueError: If [`radius`][(c).] or [`min_radius`][(c).]
25
25
  or [`max_radius`][(c).] is negative.
26
- AssertionError: If [`radius`][(c).] is set and [`min_radius`][(c).]
26
+ ValueError: If [`radius`][(c).] is set and [`min_radius`][(c).]
27
27
  or [`max_radius`][(c).] is not None.
28
28
  """
29
29
 
@@ -107,15 +107,19 @@ class CircleAvatar(LayoutControl):
107
107
 
108
108
  def before_update(self):
109
109
  super().before_update()
110
- assert self.radius is None or self.radius >= 0, (
111
- f"radius must be greater than or equal to 0, got {self.radius}"
112
- )
113
- assert self.min_radius is None or self.min_radius >= 0, (
114
- f"min_radius must be greater than or equal to 0, got {self.min_radius}"
115
- )
116
- assert self.max_radius is None or self.max_radius >= 0, (
117
- f"max_radius must be greater than or equal to 0, got {self.max_radius}"
118
- )
119
- assert self.radius is None or (
110
+ if self.radius is not None and self.radius < 0:
111
+ raise ValueError(
112
+ f"radius must be greater than or equal to 0, got {self.radius}"
113
+ )
114
+ if self.min_radius is not None and self.min_radius < 0:
115
+ raise ValueError(
116
+ f"min_radius must be greater than or equal to 0, got {self.min_radius}"
117
+ )
118
+ if self.max_radius is not None and self.max_radius < 0:
119
+ raise ValueError(
120
+ f"max_radius must be greater than or equal to 0, got {self.max_radius}"
121
+ )
122
+ if self.radius is not None and not (
120
123
  self.min_radius is None and self.max_radius is None
121
- ), "If radius is set, min_radius and max_radius must be None"
124
+ ):
125
+ raise ValueError("If radius is set, min_radius and max_radius must be None")