Skip to content

Commit

Permalink
TST: Add tests for R283 and minor refractoring for G704.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Nov 27, 2023
1 parent c403d0f commit ccf4b3e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pywrapper/pyiapws/tests/test_g704.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
r"""Tests"""
r"""Tests G704."""
import unittest
from .. import g704
import numpy as np

T_KELVIN = 273.15

class TestkH(unittest.TestCase):
r"""Test pyiawps library."""
def test_H2O(self):
r"""Test module G704 from pyiawps library."""
def test_kh_H2O(self):
T = np.asarray((300.0-T_KELVIN,))
m = g704.kh(T, "He", False)
k = np.asarray(m)
value = np.log(k[0]/1000.0)
expected = 2.6576
self.assertAlmostEqual(value, expected, places=4)

def test_D2O(self):
def test_kh_D2O(self):
T = np.asarray((300.0-T_KELVIN,))
m = g704.kh(T, "He", True)
k = np.asarray(m)
Expand All @@ -26,15 +26,15 @@ def test_D2O(self):

class TestkD(unittest.TestCase):
r"""Test pyiawps library."""
def test_H2O(self):
def test_kd_H2O(self):
T = np.asarray((300.0-T_KELVIN,))
m = g704.kd(T, "He", False)
k = np.asarray(m)
value = np.log(k[0])
expected = 15.2250
self.assertAlmostEqual(value, expected, places=4)

def test_D2O(self):
def test_kd_D2O(self):
T = np.asarray((300.0-T_KELVIN,))
m = g704.kd(T, "He", True)
k = np.asarray(m)
Expand Down
35 changes: 35 additions & 0 deletions pywrapper/pyiapws/tests/test_r283.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
r"""Test R283"""
import unittest
from .. import r283


class TestH2O(unittest.TestCase):
r"""Test module r283 from pyiapws library."""
def test_Tc_H2O(self):
expected = 647.096
value = r283.Tc_H2O
self.assertAlmostEqual(value, expected, places=3)
def test_pc_H2O(self):
expected = 22.064
value = r283.pc_H2O
self.assertAlmostEqual(value, expected, places=3)
def test_rhoc_H2O(self):
expected = 322.0
value = r283.rhoc_H2O
self.assertAlmostEqual(value, expected, places=1)

class TestD2O(unittest.TestCase):
r"""Test module r283 from pyiapws library."""
def test_Tc_D2O(self):
expected = 643.847
value = r283.Tc_D2O
self.assertAlmostEqual(value, expected, places=3)
def test_pc_D2O(self):
expected = 21.671
value = r283.pc_D2O
self.assertAlmostEqual(value, expected, places=3)
def test_rhoc_D2O(self):
expected = 356.0
value = r283.rhoc_D2O
self.assertAlmostEqual(value, expected, places=1)

0 comments on commit ccf4b3e

Please sign in to comment.