当前位置: 首页>>代码示例>>Python>>正文


Python Subscriber.address方法代码示例

本文整理汇总了Python中subscriber.Subscriber.address方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.address方法的具体用法?Python Subscriber.address怎么用?Python Subscriber.address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subscriber.Subscriber的用法示例。


在下文中一共展示了Subscriber.address方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_first_line

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
    def test_first_line(self):
        """Test if the first line of generated file is well written"""

        subs = Subscriber()
        subs.lastname = 'Debelle'
        subs.firstname = 'Anne'
        a = Address()
        a.address1 = 'rue dupre 63'
        a.address2 = 'Bruxelles 1090'
        a.city = 'belgique'
        subs.address = a
        subs.issues_to_receive = 1
        subs.save()

        line = self.export_and_get_first_line()

        self.assertTrue(line is not None)

        splitted_line = line.split('\t')
        self.assertEquals(splitted_line[2], u'DEBELLE')
        self.assertEquals(splitted_line[3], u'ANNE')
        self.assertEquals(splitted_line[4], u'')
        self.assertEquals(splitted_line[5], u'')
        self.assertEquals(splitted_line[6], u'RUE DUPRE 63')
        self.assertEquals(splitted_line[7], u'BRUXELLES 1090')
        self.assertEquals(splitted_line[8], u'')
        self.assertEquals(splitted_line[9], u'BELGIQUE')
        self.assertEquals(splitted_line[10], u'')
        self.assertEquals(splitted_line[11], u'')
        self.assertEquals(splitted_line[12], u'')
        self.assertEquals(splitted_line[13], u'')
        self.assertEquals(splitted_line[14], u'')
        self.assertEquals(splitted_line[15], u'\n')
开发者ID:rtouze,项目名称:GAabo,代码行数:35,代码来源:test_subscriber_exporter.py

示例2: test_field_length

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
    def test_field_length(self):
        """test if the fields in the output file does not exceed character limits"""
        big_string = ''.join(['b' for i in xrange(1, 40)])
        subscriber = Subscriber()
        subscriber.lastname = big_string
        subscriber.firstname = big_string
        subscriber.company = big_string
        a = Address()
        a.address1 = big_string
        a.address2 = big_string
        a.post_code = 123456 
        a.city = big_string
        subscriber.address = a
        subscriber.issues_to_receive = 10
        subscriber.save()
        line = self.export_and_get_first_line()

        splitted_line = line.split('\t')
        self.assertTrue(len(splitted_line[0]) <= 20)
        self.assertTrue(len(splitted_line[1]) <= 12)
        self.assertTrue(len(splitted_line[2]) <= 32)
        self.assertTrue(len(splitted_line[3]) <= 20)
        self.assertTrue(len(splitted_line[4]) <= 32)
        self.assertTrue(len(splitted_line[5]) <= 32)
        self.assertTrue(len(splitted_line[6]) <= 32)
        self.assertTrue(len(splitted_line[7]) <= 32)
        self.assertTrue(len(splitted_line[8]) <= 5)
        self.assertTrue(len(splitted_line[9]) <= 26)
        self.assertTrue(len(splitted_line[10]) <= 8)
        self.assertTrue(len(splitted_line[11]) <= 3)
        self.assertTrue(len(splitted_line[12]) <= 32)
        self.assertTrue(len(splitted_line[13]) <= 32)
        self.assertTrue(len(splitted_line[14]) <= 32)
        self.assertTrue(len(splitted_line[15]) <= 32)
开发者ID:rtouze,项目名称:GAabo,代码行数:36,代码来源:test_subscriber_exporter.py

示例3: init_company_subscriber_without_name

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def init_company_subscriber_without_name(self):
     """Initialize a subscriber without name info but with company info."""
     sub = Subscriber()
     sub.company = 'Google'
     a = Address()
     a.address1 = 'Address'
     a.city = 'USA'
     sub.address = a
     sub.issues_to_receive = 0
     sub.save()
开发者ID:rtouze,项目名称:GAabo,代码行数:12,代码来源:test_subscriber_exporter.py

示例4: test_noexception_with_emtpy_string_postcode

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def test_noexception_with_emtpy_string_postcode(self):
     """Test that former empty postcode leads to no export error exception"""
     subscriber = Subscriber()
     subscriber.lastname = 'toto'
     subscriber.issues_to_receive = 1
     a = Address()
     a.post_code = 0
     subscriber.address = a
     subscriber.save()
     line = self.export_and_get_first_line()
     self.assertEqual(line.split('\t')[8], '')
开发者ID:rtouze,项目名称:GAabo,代码行数:13,代码来源:test_subscriber_exporter.py

示例5: test_null_post_code_format

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def test_null_post_code_format(self):
     """Test the postcode format when a null postcode is in db: 00000 is
     ugly"""
     sub = Subscriber()
     sub.lastname = 'toto'
     address = Address()
     address.post_code = 0
     sub.address = address
     sub.save()
     dict_list = SubscriberAdapter.get_subscribers_from_lastname('toto')
     new_sub = dict_list[0]
     self.assertEquals('', new_sub['post_code'])
开发者ID:rtouze,项目名称:GAabo,代码行数:14,代码来源:test_gaabo_controler.py

示例6: set_regular_subscriber

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def set_regular_subscriber(self):
     sub = Subscriber()
     sub.lastname = 'Nom'
     sub.firstname = 'Prenom'
     sub.name_addition = 'NameAddition'
     a = Address()
     a.address1 = 'Adresse'
     a.address2 = 'Addition'
     a.post_code = 12345
     a.city = 'Ville'
     sub.address = a
     return sub
开发者ID:rtouze,项目名称:GAabo,代码行数:14,代码来源:test_subscriber_exporter.py

示例7: test_5_digit_post_code

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def test_5_digit_post_code(self):
     """Checks that the exported post_code is always written with 5 digits,
     even if the first one is 0."""
     sub = Subscriber()
     sub.issues_to_receive = 1
     a = Address()
     a.post_code = 1300
     sub.address = a
     sub.save()
     line = self.export_and_get_first_line()
     splitted_line = line.split('\t')
     self.assertEqual(splitted_line[8], '01300')
开发者ID:rtouze,项目名称:GAabo,代码行数:14,代码来源:test_subscriber_exporter.py

示例8: test_subscriber_address

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
    def test_subscriber_address(self):
        sub = Subscriber()
        address = Address()
        sub.lastname = 'toto'
        address.address1 = '11 rue bilou'
        address.address2 = 'batiment 1'
        address.post_code = '66066'
        address.city = 'NYC'
        sub.address = address
        sub.save()

        retrieved_sub = Subscriber.get_subscribers_from_lastname('toto')[0]
        retieved_address = retrieved_sub.address
        self.assertEqual('NYC', retieved_address.city)
开发者ID:rtouze,项目名称:GAabo,代码行数:16,代码来源:test_subscriber.py

示例9: save_basic_subscriber

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def save_basic_subscriber(self):
     sub = Subscriber()
     sub.lastname = 'Doe'
     sub.firstname = 'John'
     sub.company = 'Apave'
     a = Address()
     a.city = 'Rouen'
     sub.address = a
     sub.issues_to_receive = 5
     sub.hors_serie1 = 6
     sub.subscription_price = 20
     sub.membership_price = 30
     sub.subscription_date = datetime.date(2011, 07, 12)
     sub.save()
开发者ID:rtouze,项目名称:GAabo,代码行数:16,代码来源:test_subscriber_exporter.py

示例10: test_handle_name_addition

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
 def test_handle_name_addition(self):
     """Tests that if we have a name_addition, it goes in the first address
     field"""
     subscriber = Subscriber()
     subscriber.issues_to_receive = 1
     subscriber.lastname = 'Dupond'
     subscriber.firstname = 'Toto'
     subscriber.name_addition = 'Chez lulu'
     a = Address()
     a.address1 = '14 Rue lalala'
     subscriber.address = a
     subscriber.save()
     line = self.export_and_get_first_line()
     splitted = line.split('\t')
     self.assertEqual('CHEZ LULU', splitted[5])
     self.assertEqual('14 RUE LALALA', splitted[6])
开发者ID:rtouze,项目名称:GAabo,代码行数:18,代码来源:test_subscriber_exporter.py

示例11: test_get_subs_address_by_lastname

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import address [as 别名]
    def test_get_subs_address_by_lastname(self):
        """Tests address fields on dict retrieved by the adapter"""
        sub = Subscriber()
        sub.lastname = 'toto'
        address = Address()
        address.address1 = '42 rue truc'
        address.address2 = 'bat B'
        address.post_code = 38100
        address.city = 'Paris'
        sub.address = address
        sub.save()

        dict_list = SubscriberAdapter.get_subscribers_from_lastname('toto')
        new_sub = dict_list[0]
        self.assertEquals('42 rue truc', new_sub['address'])
        self.assertEquals('bat B', new_sub['address_addition'])
        self.assertEquals('38100', new_sub['post_code'])
        self.assertEquals('Paris', new_sub['city'])
开发者ID:rtouze,项目名称:GAabo,代码行数:20,代码来源:test_gaabo_controler.py


注:本文中的subscriber.Subscriber.address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。