<s> """<STR_LIT>""" <EOL> import pickle <EOL> import unittest <EOL> from perfkitbenchmarker import units <EOL> class UnitRegistryTestCase ( unittest . TestCase ) : <EOL> def testUnitNotEqual ( self ) : <EOL> self . assertFalse ( units . byte != units . Unit ( '<STR_LIT>' ) ) <EOL> def testKB ( self ) : <EOL> self . assertEqual ( units . ParseExpression ( '<STR_LIT>' ) , <EOL> units . ParseExpression ( '<STR_LIT>' ) ) <EOL> def testIntPercent ( self ) : <EOL> q = units . ParseExpression ( '<STR_LIT>' ) <EOL> self . assertEqual ( q . magnitude , <NUM_LIT:10> ) <EOL> self . assertEqual ( q . units , units . percent ) <EOL> def testFloatPercent ( self ) : <EOL> q = units . ParseExpression ( '<STR_LIT>' ) <EOL> self . assertEqual ( q . magnitude , <NUM_LIT> ) <EOL> self . assertEqual ( q . units , units . percent ) <EOL> class TestPintPickling ( unittest . TestCase ) : <EOL> def testSameUnitRegistry ( self ) : <EOL> q_prepickle = <NUM_LIT:1.0> * units . Unit ( '<STR_LIT>' ) <EOL> q_pickled = pickle . dumps ( q_prepickle ) <EOL> q_postpickle = pickle . loads ( q_pickled ) <EOL> self . assertEqual ( q_prepickle , q_postpickle ) <EOL> def testNewUnitRegistry ( self ) : <EOL> q_prepickle = <NUM_LIT:1.0> * units . Unit ( '<STR_LIT>' ) <EOL> q_pickled = pickle . dumps ( q_prepickle ) <EOL> units . _UNIT_REGISTRY = units . _UnitRegistry ( ) <EOL> q_postpickle = pickle . loads ( q_pickled ) <EOL> new_second = <NUM_LIT:1.0> * units . Unit ( '<STR_LIT>' ) <EOL> self . assertEqual ( q_postpickle , new_second ) <EOL> q_postpickle . to ( new_second ) <EOL> def testPickleKB ( self ) : <EOL> q_prepickle = units . ParseExpression ( '<STR_LIT>' ) <EOL> q_pickled = pickle . dumps ( q_prepickle ) <EOL> q_postpickle = pickle . loads ( q_pickled ) <EOL> self . assertEqual ( q_prepickle , q_postpickle ) <EOL> def testPicklePercent ( self ) : <EOL> q = units . ParseExpression ( '<STR_LIT>' ) <EOL> self . assertEqual ( q , pickle . loads ( pickle . dumps ( q ) ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
