<commit_before>import unittest
from .check_vals import carbon_ref as ref
import cbsyst as cb

class TestInputOutput(unittest.TestCase):
    """Test internal consistency of input/output condition calculations"""

    def test_Carbon(self):
        
        with self.subTest(msg='Temperature Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, T_in=20, T_out=30)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, T_in=30, T_out=20)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Salinity Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, S_in=28.2, S_out=38.1)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, S_in=38.1, S_out=28.2)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Pressure Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, P_in=0, P_out=400)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, P_in=400, P_out=0)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
<commit_msg>test in/out conditions in CBsys<commit_after>import unittest
from .check_vals import carbon_ref as ref
import cbsyst as cb

class TestInputOutput(unittest.TestCase):
    """Test internal consistency of input/output condition calculations"""

    def test_Csys(self):
        
        with self.subTest(msg='Temperature Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, T_in=20, T_out=30)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, T_in=30, T_out=20)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Salinity Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, S_in=28.2, S_out=38.1)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, S_in=38.1, S_out=28.2)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Pressure Effect'):      
            c1 = cb.Csys(pHtot=8.1, TA=2300, P_in=0, P_out=400)
            c2 = cb.Csys(pHtot=c1.pHtot, TA=2300, P_in=400, P_out=0)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            

    def test_CBsys(self):
        
        with self.subTest(msg='Temperature Effect'):      
            c1 = cb.CBsys(pHtot=8.1, TA=2300, T_in=20, T_out=30, BT=385., dBT=39.4)
            c2 = cb.CBsys(pHtot=c1.pHtot, TA=2300, T_in=30, T_out=20, BT=385., dBT=39.4)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Salinity Effect'):      
            c1 = cb.CBsys(pHtot=8.1, TA=2300, S_in=28.2, S_out=38.1, BT=385., dBT=39.4)
            c2 = cb.CBsys(pHtot=c1.pHtot, TA=2300, S_in=38.1, S_out=28.2, BT=385., dBT=39.4)
            self.assertAlmostEqual(c1.pHtot_in.item(), c2.pHtot.item(), places=6)
            
        with self.subTest(msg='Pressure Effect'):      
            c1 = cb.CBsys(pHtot=8.1, TA=2300, P_in=0, P_out=400, BT=385., dBT=39.4)
            c2 = cb.CBsys(pHtot=c1.pHtot, TA=2300, P_in=400, P_out=0, BT=385., dBT=39.4)
            self.assertAlmostEqual(c1.pHtot_in, c2.pHtot.item(), places=6)
            
{'fraction_non_alphanumeric': 0.14547146401985112, 'fraction_numerical': 0.08188585607940446, 'mean_word_length': 2.3663883089770357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1265291', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1281, 'n_words': 208}