コード例 #1
0
def test_choice_equals():
    choice_a = choices.Choice(value=123, label='123')
    choice_b = choices.Choice(value=123)
    choice_c = choices.Choice(value=456, label='123')

    assert not (choice_a == 'test')
    assert choice_a == 123
    assert not choice_a == 456
    assert choice_a == choice_a
    assert choice_a == choice_b
    assert choice_a != choice_c
コード例 #2
0
class ContractStatesEnum(choices.Choices):
    Open = choices.Choice(10, _('open'))
    Payed = choices.Choice(20, _('payed'))
    Invoice_created = choices.Choice(30, _('Invoice created'))
    Invoice_sent = choices.Choice(40, _('Invoice sent'))
    Quote_created = choices.Choice(50, _('Quote created'))
    Quote_sent = choices.Choice(60, _('Quote sent'))
    PurchaseOrder_created = choices.Choice(70, _('Purchaseorder created'))
    Customer_cant_pay = choices.Choice(90, _('Unpayed'))
    Deleted = choices.Choice(100, _('Deleted'))
コード例 #3
0
class ContractStatesLabelEnum(choices.Choices):
    Open = choices.Choice(10, 'danger')
    Payed = choices.Choice(20, 'default')
    Invoice_created = choices.Choice(30, 'warning')
    Invoice_sent = choices.Choice(40, 'warning')
    Quote_created = choices.Choice(50, 'primary')
    Quote_sent = choices.Choice(60, 'primary')
    PurchaseOrder_created = choices.Choice(70, 'success')
    Customer_cant_pay = choices.Choice(90, 'info')
    Deleted = choices.Choice(100, 'default')
コード例 #4
0
class PostalAddressPurpose(choices.Choices):
    DeliveryAddress = choices.Choice('D', _('Delivery Address'))
    BillingAddress = choices.Choice('B', _('Billing Address'))
    ContactAddress = choices.Choice('C', _('Contact Address'))
コード例 #5
0
class EmailAddressPurpose(choices.Choices):
    Private = choices.Choice('H', _('Private'))
    Business = choices.Choice('O', _('Business'))
コード例 #6
0
class PhoneAddressPurpose(choices.Choices):
    Private = choices.Choice('H', _('Private'))
    Business = choices.Choice('O', _('Business'))
    MobilePrivate = choices.Choice('P', _('Mobile Private'))
    MobileBusiness = choices.Choice('B', _('Mobile Business'))
コード例 #7
0
def test_choice_deconstruct():
    choices.Choice().deconstruct()
    choices.Choice(value=123).deconstruct()
    choices.Choice(value=123, label='123').deconstruct()
コード例 #8
0
 class Gender(choices.Choices):
     Male = choices.Choice('m', _('Male'))
     Female = choices.Choice('f', _('Female'))
     Other = choices.Choice('o', _('Other'))
コード例 #9
0
 class Enum(choices.Choices):
     Foo = choices.Choice()
     Bar = choices.Choice()
     Spam = choices.Choice()
     Eggs = choices.Choice()
コード例 #10
0
 class Gender(choices.Choices):
     Male = choices.Choice('m')
     Female = choices.Choice('f')
     Other = choices.Choice('o')
コード例 #11
0
class PostalAddressPrefix(choices.Choices):
    Company = choices.Choice('F', _('Company'))
    Mister = choices.Choice('H', _('Mr'))
    Misses = choices.Choice('W', _('Mrs'))
    Miss = choices.Choice('G', _('Ms'))