=================
Refurbish tools
=================

Preparing some stuff

    >>> import os.path
    >>> from pprint import pprint
    >>> from tools import get_fake_html, RefurbPageParser

    >>> fakes_dir = os.path.abspath('') + '/fakes_html/'
    >>> fake_html = get_fake_html(os.path.join(fakes_dir, 'fr_macbook_air.html'))

    >>> mbairs = RefurbPageParser(fake_html, 'macbook air')

    ok now we have a list of macbooks air !
    
    >>> len(mbairs.products)
    3

    What purpose the refurb for macbook airs today ?

    >>> pprint(mbairs.get_titles())
    ['MacBook Air Intel Core\xc2\xa02 Duo 1,86\xc2\xa0GHz reconditionn\xc3\xa9',
     'MacBook Air Intel Core 2 Duo 1,86\xc2\xa0GHz reconditionn\xc3\xa9',
     'MacBook Air Intel Core\xc2\xa02 Duo 2.13\xc2\xa0GHz reconditionn\xc3\xa9']

    which prices ?

    >>> pprint(mbairs.get_prices())
    [1149, 1349, 1449]

    what can you saving, currency and percent ?
    
    >>> pprint(mbairs.get_savings())
    [(250, 17), (250, 15), (250, 14)]

    what are the specs of each product ?

    >>> pprint(mbairs.get_specs())
    [['\xc3\x89cran large brillant de 13,3\xc2\xa0pouces',
      '2\xc2\xa0Go de m\xc3\xa9moire',
      'Disque dur SATA 120\xc2\xa0Go',
      'Carte graphique NVIDIA GeForce 9400M',
      'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e'],
     ['\xc3\x89cran panoramique 13,3\xc2\xa0pouces',
      'M\xc3\xa9moire\xc2\xa0: 2\xc2\xa0Go',
      'Disque dur 128\xc2\xa0Go',
      '802.11n int\xc3\xa9gr\xc3\xa9\xc2\xa0; module Bluetooth et Wi-Fi\xc2\xa02.1 + EDR',
      'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e'],
     ['\xc3\x89cran large brillant de 13,3\xc2\xa0pouces',
      '2\xc2\xa0Go de m\xc3\xa9moire',
      'Disque dur 128\xc2\xa0Go',
      'Carte graphique NVIDIA GeForce 9400M',
      'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e']]


    oh i see you want a resume ! :)

    >>> pprint(mbairs.products)
    [{'currency_discount': 250,
      'index': 1,
      'percent_discount': 17,
      'price': 1149,
      'product_type': 'macbook air',
      'specs': ['\xc3\x89cran large brillant de 13,3\xc2\xa0pouces',
                '2\xc2\xa0Go de m\xc3\xa9moire',
                'Disque dur SATA 120\xc2\xa0Go',
                'Carte graphique NVIDIA GeForce 9400M',
                'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e'],
      'title': 'MacBook Air Intel Core\xc2\xa02 Duo 1,86\xc2\xa0GHz reconditionn\xc3\xa9'},
     {'currency_discount': 250,
      'index': 2,
      'percent_discount': 15,
      'price': 1349,
      'product_type': 'macbook air',
      'specs': ['\xc3\x89cran panoramique 13,3\xc2\xa0pouces',
                'M\xc3\xa9moire\xc2\xa0: 2\xc2\xa0Go',
                'Disque dur 128\xc2\xa0Go',
                '802.11n int\xc3\xa9gr\xc3\xa9\xc2\xa0; module Bluetooth et Wi-Fi\xc2\xa02.1 + EDR',
                'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e'],
      'title': 'MacBook Air Intel Core 2 Duo 1,86\xc2\xa0GHz reconditionn\xc3\xa9'},
     {'currency_discount': 250,
      'index': 3,
      'percent_discount': 14,
      'price': 1449,
      'product_type': 'macbook air',
      'specs': ['\xc3\x89cran large brillant de 13,3\xc2\xa0pouces',
                '2\xc2\xa0Go de m\xc3\xa9moire',
                'Disque dur 128\xc2\xa0Go',
                'Carte graphique NVIDIA GeForce 9400M',
                'Cam\xc3\xa9ra iSight int\xc3\xa9gr\xc3\xa9e'],
      'title': 'MacBook Air Intel Core\xc2\xa02 Duo 2.13\xc2\xa0GHz reconditionn\xc3\xa9'}]


    A printable view ?
    
    >>> print mbairs
    <BLANKLINE>
    MacBook Air Intel Core 2 Duo 1,86 GHz reconditionné
    Price : 1149
    saving : 250 or 17 %
    Écran large brillant de 13,3 pouces
    2 Go de mémoire
    Disque dur SATA 120 Go
    Carte graphique NVIDIA GeForce 9400M
    Caméra iSight intégrée
    <BLANKLINE>
    MacBook Air Intel Core 2 Duo 1,86 GHz reconditionné
    Price : 1349
    saving : 250 or 15 %
    Écran panoramique 13,3 pouces
    Mémoire : 2 Go
    Disque dur 128 Go
    802.11n intégré ; module Bluetooth et Wi-Fi 2.1 + EDR
    Caméra iSight intégrée
    <BLANKLINE>
    MacBook Air Intel Core 2 Duo 2.13 GHz reconditionné
    Price : 1449
    saving : 250 or 14 %
    Écran large brillant de 13,3 pouces
    2 Go de mémoire
    Disque dur 128 Go
    Carte graphique NVIDIA GeForce 9400M
    Caméra iSight intégrée
    <BLANKLINE>
    


