unxts.interop.matplotlib 2.0.0__tar.gz → 2.0.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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: unxts.interop.matplotlib
3
- Version: 2.0.0
3
+ Version: 2.0.1
4
4
  Summary: matplotlib integration for unxt (canonical: unxts.interop.matplotlib)
5
5
  Project-URL: Bug Tracker, https://github.com/GalacticDynamics/unxt/issues
6
6
  Project-URL: Homepage, https://github.com/GalacticDynamics/unxt
@@ -41,6 +41,7 @@ test = [
41
41
  "pytest-cov>=6.2.1",
42
42
  "pytest-env>=1.1.5",
43
43
  "pytest-github-actions-annotate-failures>=0.3.0",
44
+ "pytest-xdist>=3.6.1",
44
45
  "sybil[pytest]>=9.2.0",
45
46
  ]
46
47
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.0.0'
22
- __version_tuple__ = version_tuple = (2, 0, 0)
21
+ __version__ = version = '2.0.1'
22
+ __version_tuple__ = version_tuple = (2, 0, 1)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -47,3 +47,25 @@ def test_imshow_with_quantity_extent():
47
47
  assert "mas" in ax.get_xlabel()
48
48
  finally:
49
49
  plt.close(fig)
50
+
51
+
52
+ def test_default_units_from_a_quantity():
53
+ """A quantity carries its own unit; no unwrapping needed."""
54
+ converter = uimpl.UnxtConverter()
55
+ assert converter.default_units(u.Q([1.0, 2.0], "mas"), None) == u.unit("mas")
56
+
57
+
58
+ def test_default_units_of_a_bare_scalar_is_none():
59
+ """A plain scalar has no unit and is not iterable."""
60
+ converter = uimpl.UnxtConverter()
61
+ assert converter.default_units(1.0, None) is None
62
+
63
+
64
+ def test_setup_can_be_disabled_and_re_enabled():
65
+ """Disabling removes the converter from matplotlib's registry."""
66
+ try:
67
+ uimpl.setup_matplotlib_support_for_unxt(enable=False)
68
+ assert u.quantity.AbstractQuantity not in matplotlib.units.registry
69
+ finally:
70
+ uimpl.setup_matplotlib_support_for_unxt()
71
+ assert u.quantity.AbstractQuantity in matplotlib.units.registry