<s> from __future__ import division , unicode_literals , print_function , absolute_import <EOL> from pint import formatting as fmt <EOL> from pint . testsuite import QuantityTestCase <EOL> class TestFormatter ( QuantityTestCase ) : <EOL> def test_join ( self ) : <EOL> for empty in ( tuple ( ) , [ ] ) : <EOL> self . assertEqual ( fmt . _join ( '<STR_LIT:s>' , empty ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . _join ( '<STR_LIT:*>' , '<STR_LIT>' . split ( ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . _join ( '<STR_LIT>' , '<STR_LIT>' . split ( ) ) , '<STR_LIT>' ) <EOL> def test_formatter ( self ) : <EOL> self . assertEqual ( fmt . formatter ( dict ( ) . items ( ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = <NUM_LIT:1> ) . items ( ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> ) . items ( ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> ) . items ( ) , as_ratio = False ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> , second = - <NUM_LIT:1> ) . items ( ) , as_ratio = False ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> , second = - <NUM_LIT:1> ) . items ( ) ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> , second = - <NUM_LIT:1> ) . items ( ) , single_denominator = True ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> , second = - <NUM_LIT:2> ) . items ( ) ) , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . formatter ( dict ( meter = - <NUM_LIT:1> , second = - <NUM_LIT:2> ) . items ( ) , single_denominator = True ) , <EOL> '<STR_LIT>' ) <EOL> def test_parse_spec ( self ) : <EOL> self . assertEqual ( fmt . _parse_spec ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertEqual ( fmt . _parse_spec ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , fmt . _parse_spec , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , fmt . _parse_spec , '<STR_LIT>' ) <EOL> def test_format_unit ( self ) : <EOL> self . assertEqual ( fmt . format_unit ( '<STR_LIT>' , '<STR_LIT:C>' ) , '<STR_LIT>' ) <EOL> self . assertRaises ( ValueError , fmt . format_unit , '<STR_LIT:m>' , '<STR_LIT>' ) </s>
