Skip to content

Commit

Permalink
clarify dimensionality checks for dimensionless units (thanks @Agnies…
Browse files Browse the repository at this point in the history
…zkaZaba for hint) (#1512)
  • Loading branch information
slayoo authored Feb 11, 2025
1 parent 9079c1b commit 17cf24a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions tests/smoke_tests/box/srivastava_1982/test_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_eq10(self):
m_e = eqs.eq10(m0=0.1 * si.kg / frag_mass, tau=eqs.tau(1 * si.s))

# assert
assert m_e.check("[]")
assert m_e.check(si.dimensionless)

def test_eq12(self):
with DimensionalAnalysis():
Expand All @@ -30,7 +30,7 @@ def test_eq12(self):
m_e = eqs.eq12()

# assert
assert m_e.check("[]")
assert m_e.check(si.dimensionless)

def test_eq13(self):
with DimensionalAnalysis():
Expand All @@ -43,7 +43,7 @@ def test_eq13(self):
m_e = eqs.eq13(m0=0.1 * si.kg / frag_mass, tau=eqs.tau(1 * si.s))

# assert
assert m_e.check("[]")
assert m_e.check(si.dimensionless)

def test_eq14(self):
with DimensionalAnalysis():
Expand All @@ -55,4 +55,4 @@ def test_eq14(self):
m_e = eqs.eq14()

# assert
assert m_e.check("[]")
assert m_e.check(si.dimensionless)
4 changes: 2 additions & 2 deletions tests/unit_tests/physics/test_optical.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_albedo_unit(paper):
albedo = formulae.optical_albedo.albedo(tau)

# assert
assert albedo.check("[]")
assert albedo.check(si.dimensionless)

@staticmethod
@pytest.mark.parametrize(
Expand All @@ -44,4 +44,4 @@ def test_optical_depth_unit(paper):
)

# assert
assert tau.check("[]")
assert tau.check(si.dimensionless)
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def test_reynolds_number(variant):
)

# Assert
assert re.check("[]")
assert re.check(si.dimensionless)
6 changes: 3 additions & 3 deletions tests/unit_tests/physics/test_trivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_schmidt_number():
)

# Assert
assert sc.check("[]")
assert sc.check(si.dimensionless)

@staticmethod
def test_poissonian_avoidance_function():
Expand All @@ -82,10 +82,10 @@ def test_poissonian_avoidance_function():
sut = formulae.trivia.poissonian_avoidance_function

# Act
sc = sut(
prob = sut(
r=1 / si.s,
dt=10 * si.min,
)

# Assert
assert sc.check("[]")
assert prob.check(si.dimensionless)
2 changes: 1 addition & 1 deletion tests/unit_tests/physics/test_ventilation_coefficient.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_dimensionality(variant):
re = sut(sqrt_re_times_cbrt_sc=1 * si.dimensionless)

# Assert
assert re.check("[]")
assert re.check(si.dimensionless)

@staticmethod
@pytest.mark.parametrize(
Expand Down

0 comments on commit 17cf24a

Please sign in to comment.