def test_tag_parse(self):
		p = ADIFParser('<call:4>W2PE <class:2>2A')
		t = p._next_tag()
		self.assertEquals('call', t.tag)
		self.assertEquals('W2PE', t.content)
		t = p._next_tag()
		self.assertEquals('class',t.tag)
		self.assertEquals('2A', t.content)
    def handle(self, *args, **options):
		f = open('/tmp/contacts.adif')
		d = f.read()
		p = ADIFParser(d)
		r = p.next_record()
		while r.call:
			if r.mode == 'JT65':
				qso_date = datetime.datetime.strptime(r.qso_date,'%Y%m%d')
				contact, created = Contact.objects.get_or_create(
					when = qso_date,
					callsign=r.call,
					band=r.band
				)
				if created: print 'Added',contact
				
			r = p.next_record()
	def test_record_parse(self):
		p = ADIFParser('<call:4>W2PE <class:2>2A<eor>')
		r = p.next_record()
		self.assertEquals('W2PE',r.call)
		self.assertEquals('2A',r.class_r)
	def test_eoh(self):
		p = ADIFParser('<eoh> efg')
		t = p._next_tag()
		self.assertEquals('eoh', t.tag)
	def test_eor(self):
		p = ADIFParser('<eor> abc')
		t = p._next_tag()
		self.assertEquals('eor', t.tag)
	def test_tag_case_sensitivty(self):
		p = ADIFParser('<ABc:2>CDe')
		t = p._next_tag()
		self.assertEquals('abc',t.tag)
		self.assertEquals('CD',t.content)
	def test_tag(self):
		p = ADIFParser('<abc:2>cde')
		t = p._next_tag()
		self.assertEquals('abc',t.tag)
		self.assertEquals('cd',t.content)
        def test_no_records(self):
		p = ADIFParser('Here\'s a file\n with some text but no actual record!')
		self.assertFalse(p.next_record())
	def test_empty(self):
		p = ADIFParser('')
		self.assertFalse(p.next_record())
	def test_none(self):
		p = ADIFParser(None)
		self.assertFalse(p.next_record())