Esempio n. 1
0
 def test_converting_volume_from_m3_to_in3(self):
     v = quantity.Volume(1, 'm3')
     self.assertAlmostEqual(v('cm3'), float('1000000.'), delta=1e-6)
     self.assertAlmostEqual(v('gal'),
                            float('264.1720526372959086633370175'),
                            delta=1e-6)
     self.assertAlmostEqual(v("in3"),
                            float('61023.74409473228395275688189'),
                            delta=1e-6)
Esempio n. 2
0
    def test_volumetricflow_233(self):
        l = quantity.Length(2.33, 'm')
        v = quantity.Volume(12.649, "m3")
        l1 = l * l * l
        t = quantity.Time(2.33, 'h')
        vf1 = l1 / t
        vf2 = v / t
        self.assertIsInstance(vf1, quantity.VolumetricFlow)
        self.assertAlmostEqual(vf1('m3 h-1'), float('5.4289'), delta=1e-6)

        self.assertIsInstance(vf2, quantity.VolumetricFlow)
        self.assertAlmostEqual(vf2('m3 h-1'), float('5.4289'), delta=1e-3)
Esempio n. 3
0
    def test_molar_concentration_from_n_l_v_(self):
        l = quantity.Length(2.33, 'm')
        v = quantity.Volume(12.649, 'm3')
        n = quantity.AmountOfSubstance(1, "mol")
        mc1 = n / (l * l * l)
        mc2 = n / (l**3)
        mc3 = n / l / l / l
        mc4 = n / v

        self.assertAlmostEqual(mc1('mol m-3'), float('0.0790'), delta=1e-3)
        self.assertAlmostEqual(mc2('mol m-3'), float('0.0790'), delta=1e-3)
        self.assertAlmostEqual(mc3('mol m-3'), float('0.0790'), delta=1e-3)
        self.assertAlmostEqual(mc4('mol m-3'), float('0.0790'), delta=1e-3)
Esempio n. 4
0
    def test_molar_concentration_from_n_l_v(self):
        l = quantity.Length(1, 'm')
        v = quantity.Volume(1, 'm3')
        n = quantity.AmountOfSubstance(1, "mol")
        mc1 = n / (l * l * l)
        mc2 = n / (l**3)
        mc3 = n / l / l / l
        mc4 = n / v

        self.assertEqual(mc1('mol m-3'), float('1.'))
        self.assertEqual(mc2('mol m-3'), float('1.'))
        self.assertEqual(mc3('mol m-3'), float('1.'))
        self.assertEqual(mc4('mol m-3'), float('1.'))
Esempio n. 5
0
 def test_volume_name_l_l3(self):
     v = quantity.Volume(2, 'l')
     self.assertEquals(str(v), '2.0 l')
Esempio n. 6
0
    def test_volume_name(self):
        v = quantity.Volume(2, 'm')
        self.assertEquals(str(v), '2.0 m\u00B3')

        v = quantity.Volume(2, 'dm')
        self.assertEquals(str(v), '2.0 dm\u00B3')
Esempio n. 7
0
 def test_volumetricflow_zero(self):
     v = quantity.Volume(0, 'm3')
     t = quantity.Time(1, 'h')
     vf = v / t
     self.assertIsInstance(vf, quantity.VolumetricFlow)
     self.assertEqual(vf('m3 h-1'), float('0.'))