heatmap_cli 0.26.0__tar.gz → 0.27.1__tar.gz

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.
Files changed (54) hide show
  1. {heatmap_cli-0.26.0/src/heatmap_cli.egg-info → heatmap_cli-0.27.1}/PKG-INFO +32 -33
  2. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/README.md +31 -32
  3. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/pyproject.toml +1 -1
  4. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli/__init__.py +9 -7
  5. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli/cli.py +64 -11
  6. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli/heatmap.py +25 -6
  7. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1/src/heatmap_cli.egg-info}/PKG-INFO +32 -33
  8. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli.egg-info/SOURCES.txt +3 -1
  9. heatmap_cli-0.27.1/tests/test_agg_backend.py +40 -0
  10. heatmap_cli-0.27.1/tests/test_animate_future_day.py +60 -0
  11. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_cmap_option.py +23 -0
  12. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_demo_option.py +11 -0
  13. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_heatmap_open.py +26 -0
  14. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_help_flag.py +5 -1
  15. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_purge_flag.py +0 -1
  16. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_setup_logging.py +9 -0
  17. heatmap_cli-0.27.1/tests/test_supported_formats.py +46 -0
  18. heatmap_cli-0.26.0/tests/test_verbose_flag.py +0 -31
  19. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/LICENSE.md +0 -0
  20. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/setup.cfg +0 -0
  21. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli/__main__.py +0 -0
  22. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli/py.typed +0 -0
  23. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli.egg-info/dependency_links.txt +0 -0
  24. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli.egg-info/entry_points.txt +0 -0
  25. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli.egg-info/requires.txt +0 -0
  26. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/src/heatmap_cli.egg-info/top_level.txt +0 -0
  27. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_animate_by_week.py +0 -0
  28. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_animate_no_frames.py +0 -0
  29. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_animate_open.py +0 -0
  30. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_annotate_flag.py +0 -0
  31. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_annotation_truncation.py +0 -0
  32. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_cbar_flag.py +0 -0
  33. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_cmax_option.py +0 -0
  34. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_cmin_option.py +0 -0
  35. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_configure_cbar.py +0 -0
  36. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_debug_flag.py +0 -0
  37. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_end_date_option.py +0 -0
  38. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_env_flag.py +0 -0
  39. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_heatmap_direct.py +0 -0
  40. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_heatmap_errors.py +0 -0
  41. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_heatmap_utils.py +0 -0
  42. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_heatmap_wrapper.py +0 -0
  43. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_iso_53_week_year.py +0 -0
  44. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_no_annotate.py +0 -0
  45. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_open_heatmap.py +0 -0
  46. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_output_dir_option.py +0 -0
  47. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_quiet_flag.py +0 -0
  48. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_refresh_output_dir.py +0 -0
  49. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_start_date_option.py +0 -0
  50. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_title_option.py +0 -0
  51. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_version_flag.py +0 -0
  52. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_week_option.py +0 -0
  53. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_year_option.py +0 -0
  54. {heatmap_cli-0.26.0 → heatmap_cli-0.27.1}/tests/test_yes_flag.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heatmap_cli
3
- Version: 0.26.0
3
+ Version: 0.27.1
4
4
  Summary: A console program that generates a yearly calendar heatmap.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -56,7 +56,7 @@ heatmap -h -v
56
56
  ```console
57
57
  usage: heatmap_cli [--demo [NUMBER_OF_COLORMAP]] [--seed SEED] [-y YEAR]
58
58
  [-w WEEK] [-e END_DATE] [-s START_DATE] [-O OUTPUT_DIR]
59
- [-o] [-p] [-v] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
59
+ [-o] [-p] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
60
60
  [-c COLORMAP] [-i COLORMAP_MIN_VALUE]
61
61
  [-x COLORMAP_MAX_VALUE] [-b]
62
62
  [-a | --annotate | --no-annotate] [--animate-by-week] [-q]
@@ -75,32 +75,30 @@ positional arguments:
75
75
 
76
76
  options:
77
77
  --demo [NUMBER_OF_COLORMAP]
78
- generate number of heatmaps by colormaps (default: '192')
78
+ generate number of heatmaps by colormaps (default: '194'). Implied: covers the current ISO year; -y/-w/-s/-e/-c are ignored.
79
79
  --seed SEED
80
80
  set random seed for reproducible --demo output (default: None)
81
- -y YEAR, --year YEAR
81
+ -y, --year YEAR
82
82
  filter by year from the CSV file (default: 'None')
83
- -w WEEK, --week WEEK
83
+ -w, --week WEEK
84
84
  filter until week of the year from the CSV file (default: current week)
85
- -e END_DATE, --end-date END_DATE
85
+ -e, --end-date END_DATE
86
86
  filter until the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
87
- -s START_DATE, --start-date START_DATE
87
+ -s, --start-date START_DATE
88
88
  filter from the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
89
- -O OUTPUT_DIR, --output-dir OUTPUT_DIR
89
+ -O, --output-dir OUTPUT_DIR
90
90
  set default output folder (default: 'output')
91
91
  -o, --open
92
92
  open the generated heatmap using the default program (default: False)
93
93
  -p, --purge
94
94
  remove all leftover artifacts set by --output-dir folder (default: False)
95
- -v, --verbose
96
- show verbosity of debugging log. Use -vv, -vvv for more details
97
- -t TITLE, --title TITLE
95
+ -t, --title TITLE
98
96
  set title for the heatmap (default: None)
99
- -u AUTHOR, --author AUTHOR
97
+ -u, --author AUTHOR
100
98
  set author for the heatmap (default: kianmeng.org)
101
- -f IMAGE_FORMAT, --format IMAGE_FORMAT
99
+ -f, --format IMAGE_FORMAT
102
100
  set the default image format (default: 'png')
103
- -c COLORMAP, --cmap COLORMAP
101
+ -c, --cmap COLORMAP
104
102
  Set default colormap. (default: 'RdYlGn_r')
105
103
  Available colormaps:
106
104
  Accent, Accent_r, afmhot, afmhot_r, autumn, autumn_r
@@ -119,30 +117,31 @@ options:
119
117
  hot, hot_r, hsv, hsv_r, icefire, icefire_r
120
118
  inferno, inferno_r, jet, jet_r, magma, magma_r
121
119
  mako, mako_r, managua, managua_r, nipy_spectral, nipy_spectral_r
122
- ocean, ocean_r, Oranges, Oranges_r, OrRd, OrRd_r
123
- Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r
124
- pink, pink_r, PiYG, PiYG_r, plasma, plasma_r
125
- PRGn, PRGn_r, prism, prism_r, PuBu, PuBu_r
126
- PuBuGn, PuBuGn_r, PuOr, PuOr_r, PuRd, PuRd_r
127
- Purples, Purples_r, rainbow, rainbow_r, RdBu, RdBu_r
128
- RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r
129
- RdYlGn, RdYlGn_r, Reds, Reds_r, rocket, rocket_r
130
- seismic, seismic_r, Set1, Set1_r, Set2, Set2_r
131
- Set3, Set3_r, Spectral, Spectral_r, spring, spring_r
132
- summer, summer_r, tab10, tab10_r, tab20, tab20_r
133
- tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r
134
- turbo, turbo_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r
135
- vanimo, vanimo_r, viridis, viridis_r, vlag, vlag_r
136
- winter, winter_r, Wistia, Wistia_r, YlGn, YlGn_r
137
- YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r
138
- -i COLORMAP_MIN_VALUE, --cmap-min COLORMAP_MIN_VALUE
120
+ ocean, ocean_r, okabe_ito, okabe_ito_r, Oranges, Oranges_r
121
+ OrRd, OrRd_r, Paired, Paired_r, Pastel1, Pastel1_r
122
+ Pastel2, Pastel2_r, pink, pink_r, PiYG, PiYG_r
123
+ plasma, plasma_r, PRGn, PRGn_r, prism, prism_r
124
+ PuBu, PuBu_r, PuBuGn, PuBuGn_r, PuOr, PuOr_r
125
+ PuRd, PuRd_r, Purples, Purples_r, rainbow, rainbow_r
126
+ RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r
127
+ RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r
128
+ rocket, rocket_r, seismic, seismic_r, Set1, Set1_r
129
+ Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r
130
+ spring, spring_r, summer, summer_r, tab10, tab10_r
131
+ tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r
132
+ terrain, terrain_r, turbo, turbo_r, twilight, twilight_r
133
+ twilight_shifted, twilight_shifted_r, vanimo, vanimo_r, viridis, viridis_r
134
+ vlag, vlag_r, winter, winter_r, Wistia, Wistia_r
135
+ YlGn, YlGn_r, YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r
136
+ YlOrRd, YlOrRd_r
137
+ -i, --cmap-min COLORMAP_MIN_VALUE
139
138
  Set the minimum value of the colormap range (default: None)
140
- -x COLORMAP_MAX_VALUE, --cmap-max COLORMAP_MAX_VALUE
139
+ -x, --cmap-max COLORMAP_MAX_VALUE
141
140
  Set the maximum value of the colormap range (default: None)
142
141
  -b, --cbar
143
142
  show colorbar (default: False)
144
143
  -a, --annotate, --no-annotate
145
- add count to each heatmap region (use --no-annotate to disable) (default: True)
144
+ add count to each heatmap region (use --no-annotate to disable)
146
145
  --animate-by-week
147
146
  create an animation for each day of the current week
148
147
  -q, --quiet
@@ -27,7 +27,7 @@ heatmap -h -v
27
27
  ```console
28
28
  usage: heatmap_cli [--demo [NUMBER_OF_COLORMAP]] [--seed SEED] [-y YEAR]
29
29
  [-w WEEK] [-e END_DATE] [-s START_DATE] [-O OUTPUT_DIR]
30
- [-o] [-p] [-v] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
30
+ [-o] [-p] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
31
31
  [-c COLORMAP] [-i COLORMAP_MIN_VALUE]
32
32
  [-x COLORMAP_MAX_VALUE] [-b]
33
33
  [-a | --annotate | --no-annotate] [--animate-by-week] [-q]
@@ -46,32 +46,30 @@ positional arguments:
46
46
 
47
47
  options:
48
48
  --demo [NUMBER_OF_COLORMAP]
49
- generate number of heatmaps by colormaps (default: '192')
49
+ generate number of heatmaps by colormaps (default: '194'). Implied: covers the current ISO year; -y/-w/-s/-e/-c are ignored.
50
50
  --seed SEED
51
51
  set random seed for reproducible --demo output (default: None)
52
- -y YEAR, --year YEAR
52
+ -y, --year YEAR
53
53
  filter by year from the CSV file (default: 'None')
54
- -w WEEK, --week WEEK
54
+ -w, --week WEEK
55
55
  filter until week of the year from the CSV file (default: current week)
56
- -e END_DATE, --end-date END_DATE
56
+ -e, --end-date END_DATE
57
57
  filter until the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
58
- -s START_DATE, --start-date START_DATE
58
+ -s, --start-date START_DATE
59
59
  filter from the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
60
- -O OUTPUT_DIR, --output-dir OUTPUT_DIR
60
+ -O, --output-dir OUTPUT_DIR
61
61
  set default output folder (default: 'output')
62
62
  -o, --open
63
63
  open the generated heatmap using the default program (default: False)
64
64
  -p, --purge
65
65
  remove all leftover artifacts set by --output-dir folder (default: False)
66
- -v, --verbose
67
- show verbosity of debugging log. Use -vv, -vvv for more details
68
- -t TITLE, --title TITLE
66
+ -t, --title TITLE
69
67
  set title for the heatmap (default: None)
70
- -u AUTHOR, --author AUTHOR
68
+ -u, --author AUTHOR
71
69
  set author for the heatmap (default: kianmeng.org)
72
- -f IMAGE_FORMAT, --format IMAGE_FORMAT
70
+ -f, --format IMAGE_FORMAT
73
71
  set the default image format (default: 'png')
74
- -c COLORMAP, --cmap COLORMAP
72
+ -c, --cmap COLORMAP
75
73
  Set default colormap. (default: 'RdYlGn_r')
76
74
  Available colormaps:
77
75
  Accent, Accent_r, afmhot, afmhot_r, autumn, autumn_r
@@ -90,30 +88,31 @@ options:
90
88
  hot, hot_r, hsv, hsv_r, icefire, icefire_r
91
89
  inferno, inferno_r, jet, jet_r, magma, magma_r
92
90
  mako, mako_r, managua, managua_r, nipy_spectral, nipy_spectral_r
93
- ocean, ocean_r, Oranges, Oranges_r, OrRd, OrRd_r
94
- Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r
95
- pink, pink_r, PiYG, PiYG_r, plasma, plasma_r
96
- PRGn, PRGn_r, prism, prism_r, PuBu, PuBu_r
97
- PuBuGn, PuBuGn_r, PuOr, PuOr_r, PuRd, PuRd_r
98
- Purples, Purples_r, rainbow, rainbow_r, RdBu, RdBu_r
99
- RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r
100
- RdYlGn, RdYlGn_r, Reds, Reds_r, rocket, rocket_r
101
- seismic, seismic_r, Set1, Set1_r, Set2, Set2_r
102
- Set3, Set3_r, Spectral, Spectral_r, spring, spring_r
103
- summer, summer_r, tab10, tab10_r, tab20, tab20_r
104
- tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r
105
- turbo, turbo_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r
106
- vanimo, vanimo_r, viridis, viridis_r, vlag, vlag_r
107
- winter, winter_r, Wistia, Wistia_r, YlGn, YlGn_r
108
- YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r
109
- -i COLORMAP_MIN_VALUE, --cmap-min COLORMAP_MIN_VALUE
91
+ ocean, ocean_r, okabe_ito, okabe_ito_r, Oranges, Oranges_r
92
+ OrRd, OrRd_r, Paired, Paired_r, Pastel1, Pastel1_r
93
+ Pastel2, Pastel2_r, pink, pink_r, PiYG, PiYG_r
94
+ plasma, plasma_r, PRGn, PRGn_r, prism, prism_r
95
+ PuBu, PuBu_r, PuBuGn, PuBuGn_r, PuOr, PuOr_r
96
+ PuRd, PuRd_r, Purples, Purples_r, rainbow, rainbow_r
97
+ RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r
98
+ RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r
99
+ rocket, rocket_r, seismic, seismic_r, Set1, Set1_r
100
+ Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r
101
+ spring, spring_r, summer, summer_r, tab10, tab10_r
102
+ tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r
103
+ terrain, terrain_r, turbo, turbo_r, twilight, twilight_r
104
+ twilight_shifted, twilight_shifted_r, vanimo, vanimo_r, viridis, viridis_r
105
+ vlag, vlag_r, winter, winter_r, Wistia, Wistia_r
106
+ YlGn, YlGn_r, YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r
107
+ YlOrRd, YlOrRd_r
108
+ -i, --cmap-min COLORMAP_MIN_VALUE
110
109
  Set the minimum value of the colormap range (default: None)
111
- -x COLORMAP_MAX_VALUE, --cmap-max COLORMAP_MAX_VALUE
110
+ -x, --cmap-max COLORMAP_MAX_VALUE
112
111
  Set the maximum value of the colormap range (default: None)
113
112
  -b, --cbar
114
113
  show colorbar (default: False)
115
114
  -a, --annotate, --no-annotate
116
- add count to each heatmap region (use --no-annotate to disable) (default: True)
115
+ add count to each heatmap region (use --no-annotate to disable)
117
116
  --animate-by-week
118
117
  create an animation for each day of the current week
119
118
  -q, --quiet
@@ -28,7 +28,7 @@ classifiers = [
28
28
  "Programming Language :: Python",
29
29
  "Topic :: Scientific/Engineering :: Visualization",
30
30
  ]
31
- version = "0.26.0"
31
+ version = "0.27.1"
32
32
  keywords = ["heatmap", "cli", "visualization", "calendar", "data-viz"]
33
33
  dependencies = [
34
34
  "matplotlib",
@@ -18,7 +18,6 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  import argparse
21
- import datetime
22
21
  import logging
23
22
  import platform
24
23
  import random
@@ -134,13 +133,16 @@ class DemoAction(argparse.Action):
134
133
  values: object,
135
134
  _option_string: str | None = None,
136
135
  ) -> None:
137
- """Set the namespace values required by the demo flow."""
136
+ """Record how many demo heatmaps to generate.
137
+
138
+ Only ``namespace.demo`` is set here. The demo flow's year, week,
139
+ colourbar and colormap defaults are applied once parsing has
140
+ finished (see `heatmap_cli.cli._apply_demo_overrides`), so that the
141
+ position of ``--demo`` on the command line cannot change the
142
+ outcome.
143
+ """
138
144
  demo_count = min(cast("int", values), len(CMAPS))
139
- demo_count = max(demo_count, 1)
140
- namespace.year = [datetime.datetime.now(tz=datetime.timezone.utc).year]
141
- namespace.week = 52
142
- namespace.cbar = True
143
- namespace.demo = demo_count
145
+ namespace.demo = max(demo_count, 1)
144
146
 
145
147
 
146
148
  def generate_demo(config: argparse.Namespace) -> None:
@@ -79,6 +79,19 @@ DEFAULT_CMAP = "RdYlGn_r"
79
79
  CMAP_ITEMS_PER_ROW = 6
80
80
  MAX_ISO_WEEK = 53
81
81
 
82
+ # Options that --demo overrides. --demo synthesises its own sample data for
83
+ # the current ISO year, so the options that select or restyle *that* data have
84
+ # nothing left to act on. -b/--cbar is absent on purpose: it is a store_true
85
+ # already defaulted to False, and --demo forces it to True, which is exactly
86
+ # what -b asks for, so there is nothing to report.
87
+ DEMO_IGNORED_OPTIONS = (
88
+ ("-y/--year", "year"),
89
+ ("-w/--week", "week"),
90
+ ("-s/--start-date", "start_date"),
91
+ ("-e/--end-date", "end_date"),
92
+ ("-c/--cmap", "cmap"),
93
+ )
94
+
82
95
 
83
96
  def _valid_date(s: str) -> datetime.date:
84
97
  """Validate date format.
@@ -148,7 +161,8 @@ def build_parser() -> argparse.ArgumentParser:
148
161
  dest="demo",
149
162
  help=(
150
163
  "generate number of heatmaps by colormaps "
151
- f"(default: '{len(CMAPS)}')"
164
+ f"(default: '{len(CMAPS)}'). "
165
+ "Implied: covers the current ISO year; -y/-w/-s/-e/-c are ignored."
152
166
  ),
153
167
  metavar="NUMBER_OF_COLORMAP",
154
168
  )
@@ -247,15 +261,6 @@ def build_parser() -> argparse.ArgumentParser:
247
261
  ),
248
262
  )
249
263
 
250
- parser.add_argument(
251
- "-v",
252
- "--verbose",
253
- default=0,
254
- action="count",
255
- dest="verbose",
256
- help="show verbosity of debugging log. Use -vv, -vvv for more details",
257
- )
258
-
259
264
  parser.add_argument(
260
265
  "input_filename",
261
266
  help="CSV filename (required unless --demo is used)",
@@ -531,6 +536,47 @@ def _resolve_date_filter_overrides(
531
536
  parsed_args.week = week
532
537
 
533
538
 
539
+ def _apply_demo_overrides(parsed_args: argparse.Namespace) -> None:
540
+ """Apply the --demo defaults, discarding options that cannot apply.
541
+
542
+ --demo generates its own sample data covering the current ISO year, so
543
+ the options that filter that data (-y, -w, -s, -e) and the option that
544
+ picks the colormaps (-c) are reported as ignored rather than silently
545
+ dropped. The defaults are applied here, after parsing has finished, so
546
+ that the position of --demo on the command line cannot change the
547
+ outcome.
548
+
549
+ Args:
550
+ parsed_args (argparse.Namespace): The parsed arguments, mutated in
551
+ place.
552
+
553
+ Returns:
554
+ None
555
+ """
556
+ ignored = [
557
+ option
558
+ for option, dest in DEMO_IGNORED_OPTIONS
559
+ if getattr(parsed_args, dest) is not None
560
+ ]
561
+ if ignored:
562
+ logger.warning(
563
+ "argument --demo: %s ignored, the demo data covers the "
564
+ "current year only.",
565
+ ", ".join(ignored),
566
+ )
567
+
568
+ iso_year = (
569
+ datetime.datetime.now(
570
+ tz=datetime.timezone.utc,
571
+ )
572
+ .isocalendar()
573
+ .year
574
+ )
575
+ parsed_args.year = [iso_year]
576
+ parsed_args.week = _weeks_in_iso_year(iso_year)
577
+ parsed_args.cbar = True
578
+
579
+
534
580
  def _default_year_and_week(
535
581
  now: datetime.datetime,
536
582
  ) -> tuple[list[int], int]:
@@ -572,7 +618,14 @@ def _process_args(
572
618
  # double filter between the ISO-week year column and the raw date column.
573
619
  # When only one endpoint is given it derives a partial-year view; when
574
620
  # both are given --end-date wins for the year/week since it caps the range.
575
- _resolve_date_filter_overrides(parsed_args)
621
+ #
622
+ # --demo is exempt: it brings its own data for the current ISO year, so
623
+ # resolving a date range against it would only produce a misleading
624
+ # warning about the demo's own year.
625
+ if parsed_args.demo:
626
+ _apply_demo_overrides(parsed_args)
627
+ else:
628
+ _resolve_date_filter_overrides(parsed_args)
576
629
 
577
630
  if (
578
631
  parsed_args.start_date
@@ -288,11 +288,28 @@ def _generate_static_heatmaps(
288
288
  ]
289
289
  logger.debug(args)
290
290
 
291
- with multiprocessing.Pool(
292
- initializer=_init_worker_logging,
293
- initargs=(config,),
294
- ) as pool:
295
- generated_files = pool.starmap(_generate_heatmap_wrapper, args)
291
+ generated_files: list[Path | None] = []
292
+ if len(config.cmap) == 1:
293
+ # For a single colormap, avoid spawning a multiprocessing Pool (and
294
+ # the associated per-worker imports on spawn-based platforms). This
295
+ # removes unnecessary overhead for the common default case while
296
+ # still returning the generated file so opening works as before.
297
+ seq, cmap = args[0][:2] # (seq, cmap, ...)
298
+ generated_files = [
299
+ _generate_heatmap(
300
+ seq,
301
+ cmap,
302
+ config,
303
+ pivoted_dataframe,
304
+ return_image=False,
305
+ )
306
+ ]
307
+ else:
308
+ with multiprocessing.Pool(
309
+ initializer=_init_worker_logging,
310
+ initargs=(config,),
311
+ ) as pool:
312
+ generated_files = pool.starmap(_generate_heatmap_wrapper, args)
296
313
 
297
314
  # Workers never open browsers; open the finished heatmaps from the main
298
315
  # process instead, so -o does not spawn a tab per background worker.
@@ -893,12 +910,14 @@ def _refresh_output_dir(config: argparse.Namespace) -> None:
893
910
  try:
894
911
  shutil.rmtree(output_dir)
895
912
  except OSError as e:
913
+ # Logged and skipped rather than returned from: bailing out
914
+ # here would skip the mkdir below and leave the caller with
915
+ # no output directory at all.
896
916
  logger.error(
897
917
  "Error removing directory: %s - %s.",
898
918
  output_dir,
899
919
  e,
900
920
  )
901
- return
902
921
 
903
922
  # Ensure the output directory exists for writing files.
904
923
  # This will create it if it doesn't exist or was just purged.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heatmap_cli
3
- Version: 0.26.0
3
+ Version: 0.27.1
4
4
  Summary: A console program that generates a yearly calendar heatmap.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -56,7 +56,7 @@ heatmap -h -v
56
56
  ```console
57
57
  usage: heatmap_cli [--demo [NUMBER_OF_COLORMAP]] [--seed SEED] [-y YEAR]
58
58
  [-w WEEK] [-e END_DATE] [-s START_DATE] [-O OUTPUT_DIR]
59
- [-o] [-p] [-v] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
59
+ [-o] [-p] [-t TITLE] [-u AUTHOR] [-f IMAGE_FORMAT]
60
60
  [-c COLORMAP] [-i COLORMAP_MIN_VALUE]
61
61
  [-x COLORMAP_MAX_VALUE] [-b]
62
62
  [-a | --annotate | --no-annotate] [--animate-by-week] [-q]
@@ -75,32 +75,30 @@ positional arguments:
75
75
 
76
76
  options:
77
77
  --demo [NUMBER_OF_COLORMAP]
78
- generate number of heatmaps by colormaps (default: '192')
78
+ generate number of heatmaps by colormaps (default: '194'). Implied: covers the current ISO year; -y/-w/-s/-e/-c are ignored.
79
79
  --seed SEED
80
80
  set random seed for reproducible --demo output (default: None)
81
- -y YEAR, --year YEAR
81
+ -y, --year YEAR
82
82
  filter by year from the CSV file (default: 'None')
83
- -w WEEK, --week WEEK
83
+ -w, --week WEEK
84
84
  filter until week of the year from the CSV file (default: current week)
85
- -e END_DATE, --end-date END_DATE
85
+ -e, --end-date END_DATE
86
86
  filter until the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
87
- -s START_DATE, --start-date START_DATE
87
+ -s, --start-date START_DATE
88
88
  filter from the date of the year from the CSV file and this will overwrite -y and -w option (default: None)
89
- -O OUTPUT_DIR, --output-dir OUTPUT_DIR
89
+ -O, --output-dir OUTPUT_DIR
90
90
  set default output folder (default: 'output')
91
91
  -o, --open
92
92
  open the generated heatmap using the default program (default: False)
93
93
  -p, --purge
94
94
  remove all leftover artifacts set by --output-dir folder (default: False)
95
- -v, --verbose
96
- show verbosity of debugging log. Use -vv, -vvv for more details
97
- -t TITLE, --title TITLE
95
+ -t, --title TITLE
98
96
  set title for the heatmap (default: None)
99
- -u AUTHOR, --author AUTHOR
97
+ -u, --author AUTHOR
100
98
  set author for the heatmap (default: kianmeng.org)
101
- -f IMAGE_FORMAT, --format IMAGE_FORMAT
99
+ -f, --format IMAGE_FORMAT
102
100
  set the default image format (default: 'png')
103
- -c COLORMAP, --cmap COLORMAP
101
+ -c, --cmap COLORMAP
104
102
  Set default colormap. (default: 'RdYlGn_r')
105
103
  Available colormaps:
106
104
  Accent, Accent_r, afmhot, afmhot_r, autumn, autumn_r
@@ -119,30 +117,31 @@ options:
119
117
  hot, hot_r, hsv, hsv_r, icefire, icefire_r
120
118
  inferno, inferno_r, jet, jet_r, magma, magma_r
121
119
  mako, mako_r, managua, managua_r, nipy_spectral, nipy_spectral_r
122
- ocean, ocean_r, Oranges, Oranges_r, OrRd, OrRd_r
123
- Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r
124
- pink, pink_r, PiYG, PiYG_r, plasma, plasma_r
125
- PRGn, PRGn_r, prism, prism_r, PuBu, PuBu_r
126
- PuBuGn, PuBuGn_r, PuOr, PuOr_r, PuRd, PuRd_r
127
- Purples, Purples_r, rainbow, rainbow_r, RdBu, RdBu_r
128
- RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r
129
- RdYlGn, RdYlGn_r, Reds, Reds_r, rocket, rocket_r
130
- seismic, seismic_r, Set1, Set1_r, Set2, Set2_r
131
- Set3, Set3_r, Spectral, Spectral_r, spring, spring_r
132
- summer, summer_r, tab10, tab10_r, tab20, tab20_r
133
- tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r
134
- turbo, turbo_r, twilight, twilight_r, twilight_shifted, twilight_shifted_r
135
- vanimo, vanimo_r, viridis, viridis_r, vlag, vlag_r
136
- winter, winter_r, Wistia, Wistia_r, YlGn, YlGn_r
137
- YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r
138
- -i COLORMAP_MIN_VALUE, --cmap-min COLORMAP_MIN_VALUE
120
+ ocean, ocean_r, okabe_ito, okabe_ito_r, Oranges, Oranges_r
121
+ OrRd, OrRd_r, Paired, Paired_r, Pastel1, Pastel1_r
122
+ Pastel2, Pastel2_r, pink, pink_r, PiYG, PiYG_r
123
+ plasma, plasma_r, PRGn, PRGn_r, prism, prism_r
124
+ PuBu, PuBu_r, PuBuGn, PuBuGn_r, PuOr, PuOr_r
125
+ PuRd, PuRd_r, Purples, Purples_r, rainbow, rainbow_r
126
+ RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r
127
+ RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r
128
+ rocket, rocket_r, seismic, seismic_r, Set1, Set1_r
129
+ Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r
130
+ spring, spring_r, summer, summer_r, tab10, tab10_r
131
+ tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r
132
+ terrain, terrain_r, turbo, turbo_r, twilight, twilight_r
133
+ twilight_shifted, twilight_shifted_r, vanimo, vanimo_r, viridis, viridis_r
134
+ vlag, vlag_r, winter, winter_r, Wistia, Wistia_r
135
+ YlGn, YlGn_r, YlGnBu, YlGnBu_r, YlOrBr, YlOrBr_r
136
+ YlOrRd, YlOrRd_r
137
+ -i, --cmap-min COLORMAP_MIN_VALUE
139
138
  Set the minimum value of the colormap range (default: None)
140
- -x COLORMAP_MAX_VALUE, --cmap-max COLORMAP_MAX_VALUE
139
+ -x, --cmap-max COLORMAP_MAX_VALUE
141
140
  Set the maximum value of the colormap range (default: None)
142
141
  -b, --cbar
143
142
  show colorbar (default: False)
144
143
  -a, --annotate, --no-annotate
145
- add count to each heatmap region (use --no-annotate to disable) (default: True)
144
+ add count to each heatmap region (use --no-annotate to disable)
146
145
  --animate-by-week
147
146
  create an animation for each day of the current week
148
147
  -q, --quiet
@@ -12,7 +12,9 @@ src/heatmap_cli.egg-info/dependency_links.txt
12
12
  src/heatmap_cli.egg-info/entry_points.txt
13
13
  src/heatmap_cli.egg-info/requires.txt
14
14
  src/heatmap_cli.egg-info/top_level.txt
15
+ tests/test_agg_backend.py
15
16
  tests/test_animate_by_week.py
17
+ tests/test_animate_future_day.py
16
18
  tests/test_animate_no_frames.py
17
19
  tests/test_animate_open.py
18
20
  tests/test_annotate_flag.py
@@ -41,8 +43,8 @@ tests/test_quiet_flag.py
41
43
  tests/test_refresh_output_dir.py
42
44
  tests/test_setup_logging.py
43
45
  tests/test_start_date_option.py
46
+ tests/test_supported_formats.py
44
47
  tests/test_title_option.py
45
- tests/test_verbose_flag.py
46
48
  tests/test_version_flag.py
47
49
  tests/test_week_option.py
48
50
  tests/test_year_option.py
@@ -0,0 +1,40 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ """Tests for the Agg backend switch in ``run``."""
17
+
18
+ from pathlib import Path
19
+
20
+
21
+ def test_run_keeps_agg_backend_when_already_active(
22
+ cli_runner,
23
+ csv_file,
24
+ tmpdir,
25
+ monkeypatch,
26
+ ):
27
+ """When matplotlib already uses Agg, ``run`` must not switch again.
28
+
29
+ Matplotlib defaults to ``tkagg`` on a desktop machine, but headless
30
+ environments (CI, ``MPLBACKEND=agg``) start on Agg, so the guard at the
31
+ top of ``run`` has to skip ``mpl.use``.
32
+ """
33
+ monkeypatch.setenv("MPLBACKEND", "agg")
34
+ csv = csv_file("sample.csv")
35
+
36
+ ret = cli_runner(csv, "-y", "2023", "-w", "1", expect_error=False)
37
+
38
+ assert ret.returncode == 0
39
+ output_dir = Path(str(tmpdir.join("scripttest", "output")))
40
+ assert len(list(output_dir.glob("*.png"))) >= 1
@@ -0,0 +1,60 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ """Tests for masking future days in the weekly animation."""
17
+
18
+ import argparse
19
+ from unittest.mock import patch
20
+
21
+ import pandas as pd
22
+
23
+ from heatmap_cli.heatmap import _generate_animated_heatmap
24
+
25
+
26
+ def test_animated_heatmap_skips_future_day_absent_from_pivot():
27
+ """A future day missing from the pivot must be skipped, not crash.
28
+
29
+ ``_filter_and_pivot_data`` normally returns a full 53-week pivot, but the
30
+ guard in ``_generate_animated_heatmap`` still checks membership before
31
+ writing, so exercise the path where the week column is absent.
32
+ """
33
+ config = argparse.Namespace(
34
+ annotate=False,
35
+ cbar=False,
36
+ cmap_min=None,
37
+ cmap_max=None,
38
+ author="Test Author",
39
+ title=None,
40
+ output_dir=".",
41
+ format="png",
42
+ open=False,
43
+ year=2023,
44
+ week=1,
45
+ start_date=None,
46
+ end_date=None,
47
+ cmap=["vlag"],
48
+ animate_by_week=True,
49
+ )
50
+ base_df = pd.DataFrame({"date": []})
51
+ sparse_pivot = pd.DataFrame([[1]], index=[1], columns=["02"])
52
+
53
+ with (
54
+ patch(
55
+ "heatmap_cli.heatmap._filter_and_pivot_data",
56
+ return_value=sparse_pivot,
57
+ ),
58
+ patch("heatmap_cli.heatmap._generate_heatmap", return_value=None),
59
+ ):
60
+ _generate_animated_heatmap(base_df, config)
@@ -13,6 +13,8 @@
13
13
  # You should have received a copy of the GNU Affero General Public License
14
14
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
 
16
+ from pathlib import Path
17
+
16
18
  import pytest
17
19
 
18
20
 
@@ -42,3 +44,24 @@ def test_multiple_cmaps(cli_runner, csv_file, option):
42
44
  csv = csv_file("sample.csv")
43
45
  ret = cli_runner(csv, "-d", option, "autumn", option, "RdYlGn_r")
44
46
  assert "cmap=['autumn', 'RdYlGn_r']" in ret.stderr
47
+
48
+
49
+ def test_multiple_cmaps_generate_heatmaps(cli_runner, csv_file, tmpdir):
50
+ """Two colormaps must render two heatmaps through the worker pool."""
51
+ csv = csv_file("sample.csv")
52
+ ret = cli_runner(
53
+ csv,
54
+ "-c",
55
+ "autumn",
56
+ "-c",
57
+ "viridis",
58
+ "-y",
59
+ "2023",
60
+ "-w",
61
+ "1",
62
+ expect_error=False,
63
+ )
64
+ assert ret.returncode == 0
65
+
66
+ output_dir = Path(str(tmpdir.join("scripttest", "output")))
67
+ assert len(list(output_dir.glob("*.png"))) == 2
@@ -102,6 +102,17 @@ def test_demo_does_not_clobber_user_sample(tmpdir, cli_runner):
102
102
  assert (output_dir / DEMO_SAMPLE_FILENAME).exists()
103
103
 
104
104
 
105
+ def test_demo_warns_on_ignored_year(cli_runner):
106
+ """-y is overridden by --demo, so the user must be told it is ignored."""
107
+ ret = cli_runner("--demo", 1, "-y", "2020", expect_error=False)
108
+
109
+ assert ret.returncode == 0
110
+ assert (
111
+ "argument --demo: -y/--year ignored, the demo data covers the "
112
+ "current year only." in ret.stderr
113
+ )
114
+
115
+
105
116
  def test_demo_with_purge_survives(cli_runner):
106
117
  """--demo --purge must not delete the sample CSV it just generated."""
107
118
  ret = cli_runner("--demo", 1, "-p", "-Y", expect_error=False)
@@ -81,3 +81,29 @@ def test_static_heatmaps_open_once_after_pool(tmpdir):
81
81
  _generate_static_heatmaps(df, config)
82
82
  assert mocked_open.call_count == 1
83
83
  assert mocked_open.call_args.args[0].exists()
84
+
85
+
86
+ def test_static_heatmaps_open_skips_missing_file(tmpdir):
87
+ """A heatmap that produced no file must not be opened."""
88
+ config = argparse.Namespace(
89
+ annotate=False,
90
+ cbar=False,
91
+ cmap_min=None,
92
+ cmap_max=None,
93
+ author="Test Author",
94
+ title="Test Title",
95
+ output_dir=str(tmpdir),
96
+ format="png",
97
+ open=True,
98
+ cmap=["vlag"],
99
+ )
100
+
101
+ df = pd.DataFrame([[10, 20], [30, 40]], index=[1, 2], columns=["01", "02"])
102
+
103
+ with (
104
+ patch("heatmap_cli.heatmap._generate_heatmap", return_value=None),
105
+ patch("heatmap_cli.heatmap._open_heatmap") as mocked_open,
106
+ ):
107
+ _generate_static_heatmaps(df, config)
108
+
109
+ mocked_open.assert_not_called()
@@ -59,8 +59,12 @@ def test_readme_help_block_is_in_sync(cli_runner):
59
59
  "colormap set; re-run `nox -s readme`"
60
60
  )
61
61
 
62
+ # argparse reflows the usage block to the terminal width, so compare
63
+ # wording only, not line wrapping.
64
+ collapse_whitespace = lambda text: " ".join(text.split()) # noqa: E731
65
+
62
66
  ret = cli_runner("-h", expect_error=False)
63
- assert block == ret.stdout.rstrip()
67
+ assert collapse_whitespace(block) == collapse_whitespace(ret.stdout)
64
68
 
65
69
 
66
70
  def test_help_output_has_no_trailing_whitespace(cli_runner):
@@ -35,7 +35,6 @@ def test_purge_output_folder_if_exists(cli_runner, csv_file, tmpdir):
35
35
  csv,
36
36
  "-y",
37
37
  "2024",
38
- "-v",
39
38
  "-O",
40
39
  opf,
41
40
  "-p",
@@ -16,6 +16,7 @@
16
16
  import argparse
17
17
 
18
18
  from heatmap_cli import logger, setup_logging
19
+ from heatmap_cli.heatmap import _init_worker_logging
19
20
 
20
21
 
21
22
  def _make_config(**overrides) -> argparse.Namespace:
@@ -44,3 +45,11 @@ def test_setup_logging_switches_from_quiet_to_verbose():
44
45
  setup_logging(_make_config(debug=True))
45
46
  assert len(logger.handlers) == 1
46
47
  assert logger.level == 10
48
+
49
+
50
+ def test_init_worker_logging_reapplies_setup():
51
+ """Pool workers on spawn platforms call this to reapply logging."""
52
+ _init_worker_logging(_make_config(debug=True))
53
+
54
+ assert len(logger.handlers) == 1
55
+ assert logger.level == 10
@@ -0,0 +1,46 @@
1
+ # Copyright (C) 2023,2024,2025,2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ """Tests for the ``--format`` choices derived from the Agg backend."""
17
+
18
+ from matplotlib.backends.backend_agg import FigureCanvasAgg
19
+
20
+ from heatmap_cli.cli import _get_supported_formats
21
+
22
+
23
+ def test_supported_formats_include_backend_types():
24
+ """Every format the Agg backend can write must be offered."""
25
+ formats = _get_supported_formats()
26
+ backend_types = FigureCanvasAgg.get_supported_filetypes()
27
+
28
+ assert set(backend_types).issubset(formats)
29
+
30
+
31
+ def test_supported_formats_add_gif_when_backend_lacks_it(monkeypatch):
32
+ """``gif`` is offered even on backends that do not list it.
33
+
34
+ The GIF is emitted by the ``--animate-by-week`` path via PIL, not by
35
+ ``savefig``, so it must be appended when the backend omits it.
36
+ """
37
+ monkeypatch.setattr(
38
+ FigureCanvasAgg,
39
+ "get_supported_filetypes",
40
+ classmethod(lambda *_: {"png": "Portable Network Graphics"}),
41
+ )
42
+
43
+ formats = _get_supported_formats()
44
+
45
+ assert "gif" in formats
46
+ assert "png" in formats
@@ -1,31 +0,0 @@
1
- # Copyright (C) 2023,2024,2025,2026 Kian-Meng Ang
2
- #
3
- # This program is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU Affero General Public License as published
5
- # by the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # This program is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU Affero General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Affero General Public License
14
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
-
16
- import pytest
17
-
18
-
19
- @pytest.mark.parametrize("option", ["-v", "--verbose"])
20
- def test_debug_logs(cli_runner, csv_file, option):
21
- csv = csv_file("sample.csv")
22
- ret = cli_runner(csv, "-d", option)
23
- assert "verbose=1" in ret.stderr
24
-
25
-
26
- def test_verbose_count(cli_runner, csv_file):
27
- csv = csv_file("sample.csv")
28
- for count in range(1, 4):
29
- verbose = "v" * count
30
- ret = cli_runner(csv, "-d", f"-{verbose}")
31
- assert f"verbose={count}" in ret.stderr
File without changes
File without changes