def test_price_from_string_with_ascii_encoded(self):
     currency = Currency(
         'edw',
         places=2,
         pre_symbol=u'\xa3',
         post_symbol=None,
     )
     price = currency.price_as_string(13.1)
     assert price == six.text_type(u'\xa313.10')
Beispiel #2
0
 def test_price_from_string_with_ascii_encoded(self):
     currency = Currency(
         'edw',
         places=2,
         pre_symbol=u'\xa3',
         post_symbol=None,
     )
     price = currency.price_as_string(13.1)
     assert price == six.text_type(u'\xa313.10')
Beispiel #3
0
    def test_price_from_string_with_pre_symbol(self):

        currency = Currency(
            'fjd',
            places=2,
            pre_symbol='$',
            post_symbol=None,
        )

        price = currency.price_as_string(13.1)
        assert price == '$13.10'
    def test_price_from_string_with_post_symbol(self):

        currency = Currency(
            'bhd',
            places=3,
            pre_symbol=None,
            post_symbol='BD',
        )

        price = currency.price_as_string(13.1)
        assert price == '13.100BD'
    def test_price_from_string_with_pre_symbol(self):

        currency = Currency(
            'fjd',
            places=2,
            pre_symbol='$',
            post_symbol=None,
        )

        price = currency.price_as_string(13.1)
        assert price == '$13.10'
Beispiel #6
0
    def test_price_from_string_with_post_symbol(self):

        currency = Currency(
            'bhd',
            places=3,
            pre_symbol=None,
            post_symbol='BD',
        )

        price = currency.price_as_string(13.1)
        assert price == '13.100BD'
Beispiel #7
0
    def test_eq(self):
        currency_one = Currency(code='usd',
                                factor=321,
                                places=2,
                                number=123,
                                pre_symbol='$',
                                post_symbol='USD')

        currency_two = Currency(code='usd',
                                factor=321,
                                places=2,
                                number=123,
                                pre_symbol='$',
                                post_symbol='USD')

        assert currency_one == currency_two
Beispiel #8
0
    def test_from_api_data(self):

        data = {
            'currency_factor': 100,
            'currency_places': 2,
            'currency_post_symbol': '\xa4',
            'currency_pre_symbol': '\xa3',
            'currency_code': 'gbp',
            'currency_number': 826,
        }
        currency = Currency.from_api_data(data)

        assert currency.factor == 100
        assert currency.places == 2
        assert currency.post_symbol == '\xa4'
        assert currency.pre_symbol == '\xa3'
        assert currency.code == 'gbp'
        assert currency.number == 826
    def test_from_api_data(self):

        data = {
            'currency_factor': 100,
            'currency_places': 2,
            'currency_post_symbol': '\xa4',
            'currency_pre_symbol': '\xa3',
            'currency_code': 'gbp',
            'currency_number': 826,
        }
        currency = Currency.from_api_data(data)

        assert currency.factor == 100
        assert currency.places == 2
        assert currency.post_symbol == '\xa4'
        assert currency.pre_symbol == '\xa3'
        assert currency.code == 'gbp'
        assert currency.number == 826
def avail_details():
    kwargs = {
        'ticket_type':
        'BALCONY',
        'ticket_type_description':
        'Balcony',
        'price_band':
        'A',
        'price_band_description':
        'AYYY!',
        'seatprice':
        47,
        'surcharge':
        0,
        'currency':
        Currency(
            code='gbp',
            factor=100,
            places=2,
            number=826,
            pre_symbol='#',
            post_symbol='',
        ),
        'first_date':
        datetime.date(2016, 11, 29),
        'last_date':
        datetime.date(2017, 3, 27),
        'calendar_masks': {
            2016: {
                12: 1065287163,
                11: 805306368
            },
            2017: {
                2: 251526135,
                1: 2012209087,
                3: 117308407
            }
        },
        'weekday_mask':
        63,
    }
    details = AvailabilityDetails(**kwargs)
    return details
Beispiel #11
0
    def test_neq_code(self):
        currency_one = Currency('gbp')
        currency_two = Currency('usd')

        assert currency_one != currency_two
Beispiel #12
0
    def test_neq_post_symbol(self):
        currency_one = Currency('gbp', post_symbol='$')
        currency_two = Currency('gbp', post_symbol='@')

        assert currency_one != currency_two
Beispiel #13
0
    def test_neq_factor(self):
        currency_one = Currency('gbp', factor=123)
        currency_two = Currency('gbp', factor=321)

        assert currency_one != currency_two
Beispiel #14
0
    def test_neq_number(self):
        currency_one = Currency('gbp', number=123)
        currency_two = Currency('gbp', number=321)

        assert currency_one != currency_two
Beispiel #15
0
    def test_neq_places(self):
        currency_one = Currency('gbp', places=3)
        currency_two = Currency('gbp', places=2)

        assert currency_one != currency_two
Beispiel #16
0
 def test_repr(self):
     currency = Currency('fjd')
     assert repr(currency) == '<Currency fjd>'
Beispiel #17
0
 def test_neq_none(self):
     currency = Currency('gbp')
     assert currency != None  # noqa