コード例 #1
0
ファイル: test_module.py プロジェクト: idlesign/vininfo
def test_checksum():

    assert Vin('1M8GDM9AXKP042788').verify_checksum()

    # faked
    assert not Vin('1M8GDM9AyKP042788').verify_checksum()

    # non strict
    non_strict = Vin('WBA71DC010CH14720')
    assert non_strict.verify_checksum(check_year=False)
    assert not non_strict.verify_checksum()
コード例 #2
0
def test_nissan():

    vin = Vin('5N1NJ01CXST000001')

    assert '%s' % vin
    assert vin.wmi == '5N1'
    assert vin.manufacturer == 'Nissan'
    assert vin.vds == 'NJ01CX'
    assert vin.vis == 'ST000001'
    assert vin.years == [1995]
    assert vin.region_code == '5'
    assert vin.region == 'North America'
    assert vin.country_code == '5N'
    assert vin.country == 'United States'
    assert '%s' % vin.brand == 'Nissan (Nissan)'

    details = vin.details
    assert details.model_code == 'J'
    assert details.model == ['Maxima']
    assert details.body_code == '1'
    assert details.body == ['4-Door Sedan', 'Standard Body Truck']
    assert details.engine_code == 'N'
    assert details.engine == ['VH45DE']
    assert details.plant_code == 'T'
    assert details.plant == ['Tochigi', 'Oppama']
    assert details.serial == '000001'

    assert vin.verify_checksum()
コード例 #3
0
ファイル: test_lada.py プロジェクト: zJw950430/vininfo
def test_lada():

    vin = Vin('XTAGFK330JY144213')

    assert '%s' % vin
    assert vin.wmi == 'XTA'
    assert vin.manufacturer == 'AvtoVAZ'
    assert vin.vds == 'GFK330'
    assert vin.vis == 'JY144213'
    assert vin.years == [2018, 1988]
    assert vin.region_code == 'X'
    assert vin.region == 'Europe'
    assert vin.country_code == 'XT'
    assert vin.country == 'USSR/CIS'
    assert vin.annotate() == OrderedDict([
        ('Country', 'USSR/CIS'),
        ('Manufacturer', 'AvtoVAZ'),
        ('Region', 'Europe'),
        ('Years', '2018, 1988'),
    ])
    assert '%s' % vin.brand == 'Lada (AvtoVAZ)'

    details = vin.details
    assert details.model.code == 'F'
    assert details.model.name == 'Vesta'
    assert details.body.code == 'K'
    assert details.body.name == 'Station Wagon, 5-Door'
    assert details.engine.code == '3'
    assert details.engine.name == '21179'
    assert details.transmission.code == '3'
    assert details.transmission.name == 'Manual, 5-Gear (Renault JH3 514)'
    assert details.plant.code == 'Y'
    assert details.plant.name == 'Izhevsk'
    assert details.annotate() == OrderedDict([
        ('Body', 'Station Wagon, 5-Door'),
        ('Engine', '21179'),
        ('Model', 'Vesta'),
        ('Plant', 'Izhevsk'),
        ('Serial', '144213'),
        ('Transmission', 'Manual, 5-Gear (Renault JH3 514)'),
    ])
    assert not vin.verify_checksum()
コード例 #4
0
# from vininfo import Vin
#
# vin = Vin('XTAGFK330JY144213')
#
# print(vin.annotate())
# code =vin.country_code
# valied = vin.verify_checksum()

from vininfo import Vin

vin = Vin('VF1LM1B0H36666155')

vin.country  # France
vin.manufacturer  # Renault
vin.region  # Europe
vin.wmi  # VF1
vin.vds  # LM1B0H
vin.vis  # 36666155

annotated = vin.annotate()
details = vin.details

vin.verify_checksum()  # False
Vin('1M8GDM9AXKP042788').verify_checksum()  # True

print(vin.annotate())
print(vin.vis)
コード例 #5
0
ファイル: ch-1.py プロジェクト: wlmb/perlweeklychallenge-club
#!/usr/bin/env python3

# Challenge 036
#
# TASK #1
# Write a program to validate given Vehicle Identification Number (VIN).
# For more information, please checkout wikipedia.

import sys
from vininfo import Vin

vin = Vin(sys.argv[1])
print(1 if vin.verify_checksum() else 0)