nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: yt-project/unyt
Pull request #64 (2019-02-11 03:49:34)

Improve define_unit consistency with a custom registry
Previously feeding a tuple with a custom registry unit would err, which probably shouldn't. See this example:

```python
from unyt import UnitRegistry, define_unit

reg = UnitRegistry()
define_unit('code_length', (1, 'm'), registry=reg)
define_unit('code_area', (1, 'code_length**2'), registry=reg)
```

It would result in `unyt.exceptions.UnitParseError: Could not find unit symbol 'code_length' in the provided symbols.` without this patch.


Patch:
diff --git a/unyt/unit_object.py b/unyt/unit_object.py
index 7afadb6..453b527 100644
--- a/unyt/unit_object.py
+++ b/unyt/unit_object.py
@@ -1093,7 +1093,7 @@ def define_unit(
     symbol, value, tex_repr=None, offset=None, prefixable=False, registry=None
 ):
     """
-    Define a new unit and add it to the default unit registry.
+    Define a new unit and add it to the specified unit registry.
 
     Parameters
     ----------
@@ -1138,7 +1138,7 @@ def define_unit(
         )
     if not isinstance(value, unyt_quantity):
         if _iterable(value) and len(value) == 2:
-            value = unyt_quantity(value[0], value[1])
+            value = unyt_quantity(value[0], value[1], registry=registry)
         else:
             raise RuntimeError(
                 '"value" needs to be a quantity or ' "(value, unit) tuple!"


Test patch:
diff --git a/unyt/tests/test_define_unit.py b/unyt/tests/test_define_unit.py
index 4fccaba..f7783e9 100644
--- a/unyt/tests/test_define_unit.py
+++ b/unyt/tests/test_define_unit.py
@@ -1,6 +1,7 @@
 import pytest
 
 from unyt.unit_object import define_unit
+from unyt.unit_registry import UnitRegistry
 from unyt.array import unyt_quantity
 
 
@@ -22,6 +23,14 @@ def test_define_unit():
     second = unyt_quantity(1.0, "s")
     assert g == volt / second ** (0.5)
 
+    # Test custom registry
+    reg = UnitRegistry()
+    define_unit("Foo", (1, "m"), registry=reg)
+    define_unit("Baz", (1, "Foo**2"), registry=reg)
+    h = unyt_quantity(1, "Baz", registry=reg)
+    i = unyt_quantity(1, "m**2", registry=reg)
+    assert h == i
+
 
 def test_define_unit_error():
     from unyt import define_unit
Repository: yt-project/unyt
Pull request #73 (2019-03-13 14:29:39)

add missing axis argument to np.stack call in ustack
This fixes an issue @cphyc spotted in yt in https://github.com/yt-project/yt/pull/2204. It's still an issue here so I've taken his fix and made it so it applies to unyt as well. It looks like we also dropped some tests for vstack which were in yt at some point so I've added those back.


Patch:
diff --git a/unyt/array.py b/unyt/array.py
index 863fed6..004a7f0 100644
--- a/unyt/array.py
+++ b/unyt/array.py
@@ -2141,7 +2141,7 @@ def ustack(arrs, axis=0):
     [[1 2 3]
      [2 3 4]] km
     """
-    v = np.stack(arrs)
+    v = np.stack(arrs, axis=axis)
     v = _validate_numpy_wrapper_units(v, arrs)
     return v
 


Test patch:
diff --git a/unyt/tests/test_unyt_array.py b/unyt/tests/test_unyt_array.py
index 7a34e27..545fb77 100644
--- a/unyt/tests/test_unyt_array.py
+++ b/unyt/tests/test_unyt_array.py
@@ -43,7 +43,9 @@ from unyt.array import (
     udot,
     uintersect1d,
     unorm,
+    ustack,
     uunion1d,
+    uvstack,
     loadtxt,
     savetxt,
 )
@@ -1863,9 +1865,12 @@ def test_numpy_wrappers():
     a1 = unyt_array([1, 2, 3], "cm")
     a2 = unyt_array([2, 3, 4, 5, 6], "cm")
     a3 = unyt_array([[1, 2, 3], [4, 5, 6]], "cm")
+    a4 = unyt_array([7, 8, 9, 10, 11], "cm")
     catenate_answer = [1, 2, 3, 2, 3, 4, 5, 6]
     intersect_answer = [2, 3]
     union_answer = [1, 2, 3, 4, 5, 6]
+    vstack_answer = [[2, 3, 4, 5, 6], [7, 8, 9, 10, 11]]
+    vstack_answer_last_axis = [[2, 7], [3, 8], [4, 9], [5, 10], [6, 11]]
     cross_answer = [-2, 4, -2]
     norm_answer = np.sqrt(1 ** 2 + 2 ** 2 + 3 ** 2)
     arr_norm_answer = [norm_answer, np.sqrt(4 ** 2 + 5 ** 2 + 6 ** 2)]
@@ -1897,6 +1902,15 @@ def test_numpy_wrappers():
         uconcatenate((a1, a2.v))
     with pytest.raises(RuntimeError):
         uconcatenate((a1.to("m"), a2))
+    assert_array_equal(unyt_array(vstack_answer, "cm"), uvstack([a2, a4]))
+    assert_array_equal(vstack_answer, np.vstack([a2, a4]))
+    assert_array_equal(unyt_array(vstack_answer, "cm"), ustack([a2, a4]))
+    assert_array_equal(vstack_answer, np.stack([a2, a4]))
+
+    assert_array_equal(
+        unyt_array(vstack_answer_last_axis, "cm"), ustack([a2, a4], axis=-1)
+    )
+    assert_array_equal(vstack_answer_last_axis, np.stack([a2, a4], axis=-1))
 
 
 def test_dimensionless_conversion():
Repository: yt-project/unyt
Pull request #86 (2019-05-18 18:36:08)

allow defining unit systems with a quantity
This addresses the crash @jborrow described in the comments on #72.


Patch:
diff --git a/docs/usage.rst b/docs/usage.rst
index 4afda39..c27cfb7 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -483,6 +483,21 @@ It is also legal to define a unit system using :class:`unyt.Unit
       luminous_intensity: cd
      Other Units:
 
+Or with a quantity:
+
+  >>> UnitSystem('quasmological', 3*megaparsec, .8*Msun, 42*second)
+    quasmological Unit System
+     Base Units:
+      length: 3*Mpc
+      mass: 0.8*Msun
+      time: 42*s
+      temperature: K
+      angle: rad
+      current_mks: A
+      luminous_intensity: cd
+     Other Units:
+
+
 Once you have defined a new unit system that will register the new system with a
 global registry of unit systems known to the :mod:`unyt` library. That means you
 will immediately be able to use it just like the built-in unit systems:
diff --git a/unyt/unit_systems.py b/unyt/unit_systems.py
index 076f81f..df2c8d2 100644
--- a/unyt/unit_systems.py
+++ b/unyt/unit_systems.py
@@ -214,11 +214,16 @@ class UnitSystem(object):
         )
         for k, v in self.units_map.items():
             if v is not None:
-                self.units_map[k] = parse_unyt_expr(str(v))
+                if hasattr(v, "value") and hasattr(v, "units"):
+                    self.units_map[k] = v.value * v.units.expr
+                else:
+                    self.units_map[k] = parse_unyt_expr(str(v))
         for dimension, unit in self.units_map.items():
             # CGS sets the current_mks unit to none, so catch it here
             if unit is None and dimension is dimensions.current_mks:
                 continue
+            if unit.is_Mul:
+                unit = unit.as_coeff_Mul()[1]
             if (
                 self.registry is not None
                 and self.registry[str(unit)][1] is not dimension


Test patch:
diff --git a/unyt/tests/test_unit_systems.py b/unyt/tests/test_unit_systems.py
index 58aa047..adcb9cc 100644
--- a/unyt/tests/test_unit_systems.py
+++ b/unyt/tests/test_unit_systems.py
@@ -116,3 +116,10 @@ def test_create_unit_system_from_unit_objects():
     assert s["length"] == us.Mpc
     assert s["mass"] == us.Msun
     assert s["time"] == us.s
+
+
+def test_create_unit_system_from_quantity():
+    s = UnitSystem("test_units", us.Mpc, 3 * us.Msun, us.s)
+    assert s["length"] == us.Mpc
+    assert s["mass"] == Unit("3*Msun")
+    assert s["time"] == us.s
Repository: yt-project/unyt
Pull request #96 (2019-07-02 20:59:04)

ensure EM conversions only happen when we want to change unit systems
Before this PR the following script:

```python
import unyt as u
d = 12.0*u.Gauss
print(d.in_cgs().units)
```

would print `'T'`.

We need extra logic to check if we've been asked to convert to a new unit system or not. If not then we shouldn't do the EM conversion at all.

This fixes the broken test in my yt pull request that adds support for unyt.



Patch:
diff --git a/unyt/array.py b/unyt/array.py
index 4459e55..3b97779 100644
--- a/unyt/array.py
+++ b/unyt/array.py
@@ -921,9 +921,11 @@ class unyt_array(np.ndarray):
         except MKSCGSConversionError:
             raise UnitsNotReducible(self.units, us)
         if any(conv_data):
-            to_units, (conv, offset) = _em_conversion(
-                self.units, conv_data, unit_system=us
-            )
+            um = us.units_map
+            u = self.units
+            if u.dimensions in um and u.expr == um[self.units.dimensions]:
+                return self.copy()
+            to_units, (conv, offset) = _em_conversion(u, conv_data, unit_system=us)
         else:
             to_units = self.units.get_base_equivalent(unit_system)
             conv, offset = self.units.get_conversion_factor(to_units, self.dtype)
diff --git a/unyt/unit_object.py b/unyt/unit_object.py
index e3a55e7..7a72973 100644
--- a/unyt/unit_object.py
+++ b/unyt/unit_object.py
@@ -577,6 +577,9 @@ class Unit(object):
             conv_data = _check_em_conversion(
                 self.units, registry=self.registry, unit_system=unit_system
             )
+            um = unit_system.units_map
+            if self.dimensions in um and self.expr == um[self.dimensions]:
+                return self.copy()
         except MKSCGSConversionError:
             raise UnitsNotReducible(self.units, unit_system)
         if any(conv_data):


Test patch:
diff --git a/unyt/tests/test_unyt_array.py b/unyt/tests/test_unyt_array.py
index aa933a5..c1892ce 100644
--- a/unyt/tests/test_unyt_array.py
+++ b/unyt/tests/test_unyt_array.py
@@ -1808,11 +1808,18 @@ def test_electromagnetic():
     g = 1.0 * u.gauss
     assert t.to("gauss") == 1e4 * u.gauss
     assert g.to("T") == 1e-4 * u.Tesla
-
-    qp_cgs = u.qp_cgs.in_units("C")
-    assert_equal(qp_cgs.units.dimensions, dimensions.charge_mks)
-    assert_almost_equal(qp_cgs.v, 10.0 * u.qp.v / speed_of_light_cm_per_s)
+    assert t.in_mks() == t
+    assert g.in_cgs() == g
+    t.convert_to_mks()
+    assert t == 1.0 * u.Tesla
+    g.convert_to_cgs()
+    assert g == 1.0 * u.gauss
+
+    qp_mks = u.qp_cgs.in_units("C")
+    assert_equal(qp_mks.units.dimensions, dimensions.charge_mks)
+    assert_almost_equal(qp_mks.v, 10.0 * u.qp.v / speed_of_light_cm_per_s)
     qp = 1.0 * u.qp_cgs
+    assert_equal(qp, u.qp_cgs.in_units("esu"))
     qp.convert_to_units("C")
     assert_equal(qp.units.dimensions, dimensions.charge_mks)
     assert_almost_equal(qp.v, 10 * u.qp.v / u.clight.v)
Repository: yt-project/unyt
Pull request #103 (2019-09-09 18:28:18)

Add bar to unit lookup table

ngoldbaum: Can you run [black](https://black.readthedocs.io/en/stable/) commit and push? That should fix the failing test. Other than that looks good to me.

Patch:
diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py
index 1178333..f11ca92 100644
--- a/unyt/_unit_lookup_table.py
+++ b/unyt/_unit_lookup_table.py
@@ -111,6 +111,7 @@ default_unit_symbol_lut = OrderedDict(
         ("C", (1.0, dimensions.charge_mks, 0.0, r"\rm{C}", True)),
         ("T", (1.0, dimensions.magnetic_field_mks, 0.0, r"\rm{T}", True)),
         ("Pa", (1.0, dimensions.pressure, 0.0, r"\rm{Pa}", True)),
+        ("bar", (1.0e5, dimensions.pressure, 0.0, r"\rm{bar}", True)),
         ("V", (1.0, dimensions.electric_potential, 0.0, r"\rm{V}", True)),
         ("F", (1.0, dimensions.capacitance, 0.0, r"\rm{F}", True)),
         ("Ω", (1.0, dimensions.resistance, 0.0, r"\Omega", True)),


Test patch:
diff --git a/unyt/tests/test_units.py b/unyt/tests/test_units.py
index f74735b..40512ed 100644
--- a/unyt/tests/test_units.py
+++ b/unyt/tests/test_units.py
@@ -771,3 +771,9 @@ def test_show_all_units_doc_table_ops():
             (1 * u).in_cgs()
         except UnitsNotReducible:
             pass
+
+
+def test_hPa_mbar():
+    assert Unit("hPa").dimensions == Unit("bar").dimensions
+    assert (5 * Unit("hPa") == 5 * Unit("mbar")).all()
+    assert (5 * Unit("hPa") != 1 * Unit("bar")).all()
Repository: yt-project/unyt
Pull request #106 (2019-09-11 17:34:40)

Add support for unit percent


Patch:
diff --git a/unyt/_parsing.py b/unyt/_parsing.py
index 911b028..54a048f 100644
--- a/unyt/_parsing.py
+++ b/unyt/_parsing.py
@@ -84,6 +84,9 @@ def parse_unyt_expr(unit_expr):
         # Bug catch...
         # if unit_expr is an empty string, parse_expr fails hard...
         unit_expr = "1"
+    # Avoid a parse error if someone uses the percent unit and the
+    # parser tries to interpret it as the modulo operator
+    unit_expr = unit_expr.replace("%", "percent")
     try:
         unit_expr = parse_expr(
             unit_expr, global_dict=global_dict, transformations=unit_text_transform
diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py
index f11ca92..229dbf4 100644
--- a/unyt/_unit_lookup_table.py
+++ b/unyt/_unit_lookup_table.py
@@ -182,6 +182,7 @@ default_unit_symbol_lut = OrderedDict(
         ("smoot", (1.7018, dimensions.length, 0.0, r"\rm{smoot}", False)),
         # dimensionless stuff
         ("dimensionless", (1.0, dimensions.dimensionless, 0.0, r"", False)),
+        ("%", (0.01, dimensions.dimensionless, 0.0, r"\%", False)),
         # times
         ("min", (sec_per_min, dimensions.time, 0.0, r"\rm{min}", False)),
         ("hr", (sec_per_hr, dimensions.time, 0.0, r"\rm{hr}", False)),
@@ -458,6 +459,7 @@ default_unit_name_alternatives = OrderedDict(
         ("mp", ("proton_mass",)),
         ("Sv", ("sievert",)),
         ("nt", ("nit",)),
+        ("%", ("percent",)),
         # Planck units
         ("m_pl", ("planck_mass",)),
         ("l_pl", ("planck_length",)),


Test patch:
diff --git a/unyt/tests/test_units.py b/unyt/tests/test_units.py
index 40512ed..40e1f4d 100644
--- a/unyt/tests/test_units.py
+++ b/unyt/tests/test_units.py
@@ -777,3 +777,17 @@ def test_hPa_mbar():
     assert Unit("hPa").dimensions == Unit("bar").dimensions
     assert (5 * Unit("hPa") == 5 * Unit("mbar")).all()
     assert (5 * Unit("hPa") != 1 * Unit("bar")).all()
+
+
+def test_percent():
+    a = 300 * Unit("percent")
+    b = 3.0 * Unit("dimensionless")
+    c = 300.0 * Unit("%")
+    d = 300.0 * Unit("V*%/V")
+
+    assert a == b
+    assert str(a) == "300 %"
+    assert repr(a) == "unyt_quantity(300, '%')"
+
+    assert a == c
+    assert c == d
Repository: yt-project/unyt
Pull request #108 (2019-09-23 16:11:44)

Adding a test that fails for yt on appveyor.
The clip function in yt master is causing issues when called from within the ytdata frontend.  This test seems to be the smallest way I can reproduce it.  However, I can only make it fail on appveyor.  I'm optimistic that issuing this pull-request will help track down why it's problematic, and where the (platform specific?) failure occurs.


Patch:
diff --git a/unyt/array.py b/unyt/array.py
index ac7e643..6a655e3 100644
--- a/unyt/array.py
+++ b/unyt/array.py
@@ -1712,7 +1712,12 @@ class unyt_array(np.ndarray):
                     )
         else:
             if ufunc is clip:
-                inp = (inputs[0].view(np.ndarray), inputs[1], inputs[2])
+                inp = []
+                for i in inputs:
+                    if isinstance(i, unyt_array):
+                        inp.append(i.to(inputs[0].units).view(np.ndarray))
+                    else:
+                        inp.append(i)
                 if out is not None:
                     _out = out.view(np.ndarray)
                 else:


Test patch:
diff --git a/unyt/tests/test_unyt_array.py b/unyt/tests/test_unyt_array.py
index 18b0f09..78b6caf 100644
--- a/unyt/tests/test_unyt_array.py
+++ b/unyt/tests/test_unyt_array.py
@@ -2280,3 +2280,12 @@ def test_clip():
 
     assert_array_equal(data, answer)
     assert data.units == answer.units
+
+    left_edge = [0.0, 0.0, 0.0] * km
+    right_edge = [1.0, 1.0, 1.0] * km
+
+    positions = [[0.0, 0.0, 0.0], [1.0, 1.0, -0.1], [1.5, 1.0, 0.9]] * km
+    np.clip(positions, left_edge, right_edge, positions)
+    assert positions.units == left_edge.units
+    assert positions.max() == 1.0 * km
+    assert positions.min() == 0.0 * km
Repository: yt-project/unyt
Pull request #114 (2019-12-11 14:12:10)

Fix unit hash function
I discovered that the `__hash__` implementation for `Unit` is incorrect when looking at a perf bottleneck in some code; things were slowing down because the `@lru_cache` on `_multiply_units` was very rarely being hit.

The Python docs say:
> Objects which are instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their id().

The previous implementation which just forwarded to the default hash would vary based on the `id()` of the object, and thus the `@lru_cache` would always miss.

I'm not entirely sure this implementation is correct. This is what I invented late last night, but it looks a bit unlike the `__eq__`, but my guess at a test cast that would prove this incorrect isn't failing.


Patch:
diff --git a/unyt/unit_object.py b/unyt/unit_object.py
index cb93a43..54c34c1 100644
--- a/unyt/unit_object.py
+++ b/unyt/unit_object.py
@@ -317,7 +317,7 @@ class Unit(object):
         return self
 
     def __hash__(self):
-        return super(Unit, self).__hash__()
+        return hash(self.registry.unit_system_id) ^ hash(self.expr)
 
     # end sympy conventions
 


Test patch:
diff --git a/unyt/tests/test_units.py b/unyt/tests/test_units.py
index 40e1f4d..35661e7 100644
--- a/unyt/tests/test_units.py
+++ b/unyt/tests/test_units.py
@@ -791,3 +791,14 @@ def test_percent():
 
     assert a == c
     assert c == d
+
+
+def test_equal_has_same_hash():
+    a = Unit("m")
+    b = Unit("m")
+    c = Unit("m*s/s")
+
+    assert a == b
+    assert b == c
+    assert hash(a) == hash(b)
+    assert hash(b) == hash(c)
Repository: yt-project/unyt
Pull request #135 (2020-02-02 16:11:46)

Add inductance unit henry


Patch:
diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py
index 129b72c..6d165bc 100644
--- a/unyt/_unit_lookup_table.py
+++ b/unyt/_unit_lookup_table.py
@@ -115,6 +115,7 @@ default_unit_symbol_lut = OrderedDict(
         ("bar", (1.0e5, dimensions.pressure, 0.0, r"\rm{bar}", True)),
         ("V", (1.0, dimensions.electric_potential, 0.0, r"\rm{V}", True)),
         ("F", (1.0, dimensions.capacitance, 0.0, r"\rm{F}", True)),
+        ("H", (1.0, dimensions.inductance, 0.0, r"\rm{H}", True)),
         ("Ω", (1.0, dimensions.resistance, 0.0, r"\Omega", True)),
         ("Wb", (1.0, dimensions.magnetic_flux, 0.0, r"\rm{Wb}", True)),
         ("lm", (1.0, dimensions.luminous_flux, 0.0, r"\rm{lm}", True)),
@@ -408,6 +409,7 @@ default_unit_name_alternatives = OrderedDict(
         ("Pa", ("pascal",)),
         ("V", ("volt",)),
         ("F", ("farad",)),
+        ("H", ("henry",)),
         ("Ω", ("ohm", "Ohm")),
         ("Wb", ("weber",)),
         ("lm", ("lumen",)),
diff --git a/unyt/dimensions.py b/unyt/dimensions.py
index d6d5ef2..4cb41e5 100644
--- a/unyt/dimensions.py
+++ b/unyt/dimensions.py
@@ -145,6 +145,8 @@ resistance = resistance_mks = electric_potential_mks / current_mks
 capacitance = capacitance_mks = charge / electric_potential
 #: magnetic_flux
 magnetic_flux = magnetic_flux_mks = magnetic_field_mks * area
+#: inductance
+inductance = inductance_mks = magnetic_flux_mks / current_mks
 
 #: a list containing all derived_dimensions
 derived_dimensions = [
diff --git a/unyt/unit_systems.py b/unyt/unit_systems.py
index 1725f07..e4dc20e 100644
--- a/unyt/unit_systems.py
+++ b/unyt/unit_systems.py
@@ -319,6 +319,7 @@ mks_unit_system["frequency"] = "Hz"
 mks_unit_system["power"] = "W"
 mks_unit_system["electric_potential"] = "V"
 mks_unit_system["capacitance"] = "F"
+mks_unit_system["inductance"] = "H"
 mks_unit_system["resistance"] = "ohm"
 mks_unit_system["magnetic_flux"] = "Wb"
 mks_unit_system["luminous_flux"] = "lm"


Test patch:
diff --git a/unyt/tests/test_units.py b/unyt/tests/test_units.py
index c79141f..4f50cc8 100644
--- a/unyt/tests/test_units.py
+++ b/unyt/tests/test_units.py
@@ -825,3 +825,7 @@ def test_bel_neper():
     d = 20 * Unit("decineper")
     assert (c == d).all()
     assert Unit("dB") ** 1 == Unit("dB")
+
+
+def test_henry():
+    assert (Unit("H") / Unit("Ω")).dimensions == time
Repository: yt-project/unyt
Pull request #160 (2020-07-10 18:41:41)

Add the imperial unit mil.
The mil, 0.001 inch, is in common use here in the U.S. for printed circuit board design and production.


Patch:
diff --git a/unyt/_unit_lookup_table.py b/unyt/_unit_lookup_table.py
index 58c1f66..ba2bfb4 100644
--- a/unyt/_unit_lookup_table.py
+++ b/unyt/_unit_lookup_table.py
@@ -126,6 +126,7 @@ default_unit_symbol_lut = OrderedDict(
         ("degC", (1.0, dimensions.temperature, -273.15, r"^\circ\rm{C}", True)),
         ("delta_degC", (1.0, dimensions.temperature, 0, r"\Delta^\circ\rm{C}", True)),
         # Imperial and other non-metric units
+        ("mil", (1e-3 * m_per_inch, dimensions.length, 0.0, r"\rm{mil}", False)),
         ("inch", (m_per_inch, dimensions.length, 0.0, r"\rm{in}", False)),
         ("ft", (m_per_ft, dimensions.length, 0.0, r"\rm{ft}", False)),
         ("yd", (0.9144, dimensions.length, 0.0, r"\rm{yd}", False)),
@@ -434,6 +435,7 @@ default_unit_name_alternatives = OrderedDict(
         ("lx", ("lux",)),
         ("degC", ("degree_celsius", "degree_Celsius", "celcius", "celsius", "°C")),
         # Imperial and other non-metric units
+        ("mil", ("thou", "thousandth")),
         ("inch", ("in",)),
         ("ft", ("foot",)),
         ("yd", ("yard",)),


Test patch:
diff --git a/unyt/tests/test_unyt_array.py b/unyt/tests/test_unyt_array.py
index e338748..bd03e4b 100644
--- a/unyt/tests/test_unyt_array.py
+++ b/unyt/tests/test_unyt_array.py
@@ -2411,3 +2411,7 @@ def test_delta_degF():
     assert t3 + t1 == 11 * degF
     assert 1 * delta_degF + 2 * delta_degF == 3 * delta_degF
     assert 2 * delta_degF == unyt_quantity(2, "delta_degF")
+
+
+def test_mil():
+    assert_allclose_units(unyt_quantity(1, "mil"), unyt_quantity(0.001, "inch"))