def test_convert_bytes(self): # Test Bytes for value in self.sample_values: result = value for unit in self.byte_units: #print ("Convertion test: %sB = %s%s" % (value, result, unit)) self.assertEqual(myscript.convert_bytes(value, unit), result, ("Convert %sB in %s" % (value, unit))) result = result / self.multiple
def test_convert_bytes_to_bits(self): # Test Bytes for value in self.sample_values: self.assertEqual(myscript.convert_bytes(0, 'bps'), 0) self.assertEqual(myscript.convert_bytes(0, 'kbps'), 0) self.assertEqual(myscript.convert_bytes(0, 'Tbps'), 0) self.assertEqual(myscript.convert_bytes(1, 'bps'), 8) self.assertEqual(myscript.convert_bytes(1000, 'kbps'), 8) result = 8 * value for unit in self.bit_units: #print ("Convertion test: %sB = %s%s" % (value, result, unit)) self.assertEqual(myscript.convert_bytes(value, unit), result, ("Convert %sBps in %s" % (value, unit))) result = result / self.multiple