<s> from decimal import Decimal as D <EOL> from django . test import TestCase <EOL> from django . core . exceptions import ValidationError <EOL> from oscar . apps . shipping import models <EOL> class TestWeightBasedMethod ( TestCase ) : <EOL> def test_doesnt_allow_negative_default_weights ( self ) : <EOL> method = models . WeightBased ( <EOL> name = "<STR_LIT>" , default_weight = D ( '<STR_LIT>' ) ) <EOL> with self . assertRaises ( ValidationError ) : <EOL> method . full_clean ( ) <EOL> class TestWeightBand ( TestCase ) : <EOL> def test_doesnt_allow_negative_upper_limit ( self ) : <EOL> band = models . WeightBand ( upper_limit = D ( '<STR_LIT>' ) ) <EOL> with self . assertRaises ( ValidationError ) as cm : <EOL> band . full_clean ( ) <EOL> self . assertTrue ( '<STR_LIT>' in cm . exception . message_dict ) <EOL> def test_doesnt_allow_negative_charge ( self ) : <EOL> band = models . WeightBand ( charge = D ( '<STR_LIT>' ) ) <EOL> with self . assertRaises ( ValidationError ) as cm : <EOL> band . full_clean ( ) <EOL> self . assertTrue ( '<STR_LIT>' in cm . exception . message_dict ) </s>
