def test_get_rates(self): data = o2('Mexico') rates = data._get_rates('Mexico', 'monthly') nt.eq_(rates['landline'], u'£1.20') data.close()
def test_init(self): data = o2('Canada', 'Germany', 'Iceland', 'Pakistan', 'Singapore', 'South Africa') nt.eq_(data.country_list[0], 'Canada') nt.eq_(data.country_list[-1], 'South Africa') nt.eq_(len(data.country_list), 6) data.close()
def test_get_country_page(self): data = o2('Mexico') data._process_country_data() pq = data._get_country_page('Mexico') nt.ok_(pq.html > 100) data.close()
def test_process_country_data(self): data = o2('Mexico') data._process_country_data() nt.ok_('Mexico' in data.country_data) nt.ok_(isinstance(data.country_data['Mexico'], dict)) data.close()
def test_get(self): data = o2('Canada', 'Germany', 'Iceland', 'Pakistan') data.get('monthly') nt.eq_(data.tariffs['Canada']['landline'], u'60p') nt.eq_(data.tariffs['Germany']['landline'], u'60p') nt.eq_(data.tariffs['Iceland']['landline'], u'80p') nt.eq_(data.tariffs['Pakistan']['landline'], u'£1.20') data.close()
def test_get_paygo(self): data = o2('Canada', 'Germany', 'Iceland', 'Pakistan') data.get('paygo') nt.eq_(data.tariffs['Canada']['landline'], u'£1.50')
def test_get_country_page_ValueError(self): with nt.assert_raises(ValueError): data = o2('Mexico') data._get_country_page('Mexico')
def test_init_raises(self): with nt.assert_raises(ValueError): empty = o2() empty.close()