本文整理汇总了Python中datafeeds.usfirst_event_details_parser.UsfirstEventDetailsParser类的典型用法代码示例。如果您正苦于以下问题:Python UsfirstEventDetailsParser类的具体用法?Python UsfirstEventDetailsParser怎么用?Python UsfirstEventDetailsParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UsfirstEventDetailsParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_2012ct_bad_location
def test_2012ct_bad_location(self):
with open('test_data/usfirst_html/usfirst_event_details_2012ct.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
event['location'] = "somewhere on mars"
self.assertEqual(LocationHelper.get_lat_lng(event['location']), None)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), None)
示例2: test_parse2013flbr
def test_parse2013flbr(self):
with open('test_data/usfirst_html/usfirst_event_details_2013flbr.html', 'r') as f:
event = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "South Florida Regional")
self.assertEqual(event["event_type"], "Regional")
self.assertEqual(event["start_date"], datetime.datetime(2013, 3, 28, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2013, 3, 30, 0, 0))
self.assertEqual(event["year"], 2013)
self.assertEqual(event["venue_address"], "Great Fort Lauderdale & Broward County Convention Center\r\n1950 Eisenhower Boulevard\r\nFort Lauderdale, FL 33316\r\nUSA")
self.assertEqual(event["website"], "http://firstinflorida.org")
self.assertEqual(event["event_short"], "flbr")
示例3: test_1997il
def test_1997il(self):
with open('test_data/usfirst_html/usfirst_event_details_1997il.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
location = None
for _ in xrange(5):
location = LocationHelper.get_lat_lng(event['location'])
if location:
break
self.assertAlmostEqual(location[0], 41.8781136, places=6)
self.assertAlmostEqual(location[1], -87.6297982, places=6)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), 'America/Chicago')
示例4: test_2012ct
def test_2012ct(self):
with open('test_data/usfirst_html/usfirst_event_details_2012ct.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
location = None
for _ in xrange(5):
location = LocationHelper.get_lat_lng(event['location'])
if location:
break
self.assertAlmostEqual(location[0], 41.76371109999999, places=6)
self.assertAlmostEqual(location[1], -72.6850932, places=6)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), 'America/New_York')
示例5: test_2013flbr
def test_2013flbr(self):
with open('test_data/usfirst_html/usfirst_event_details_2013flbr.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
location = None
for _ in xrange(5):
location = LocationHelper.get_lat_lng(event['location'])
if location:
break
self.assertAlmostEqual(location[0], 26.1224386, places=6)
self.assertAlmostEqual(location[1], -80.13731740000001, places=6)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), 'America/New_York')
示例6: test_2005is
def test_2005is(self):
with open('test_data/usfirst_html/usfirst_event_details_2005is.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
location = None
for _ in xrange(5):
location = LocationHelper.get_lat_lng(event['location'])
if location:
break
self.assertAlmostEqual(location[0], 32.7940463, places=6)
self.assertAlmostEqual(location[1], 34.989571, places=6)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), 'Asia/Jerusalem')
示例7: test_2005or
def test_2005or(self):
with open('test_data/usfirst_html/usfirst_event_details_2005or.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
location = None
for _ in xrange(5):
location = LocationHelper.get_lat_lng(event['location'])
if location:
break
self.assertAlmostEqual(location[0], 45.5230622, places=6)
self.assertAlmostEqual(location[1], -122.6764816, places=6)
self.assertEqual(LocationHelper.get_timezone_id(event['location']), 'America/Los_Angeles')
示例8: test_parse2001sj
def test_parse2001sj(self):
with open('test_data/usfirst_html/usfirst_event_details_2001ca2.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "Silicon Valley Regional")
self.assertEqual(event["event_type_enum"], EventType.REGIONAL)
self.assertEqual(event["start_date"], datetime.datetime(2001, 3, 22, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2001, 3, 24, 0, 0))
self.assertEqual(event["year"], 2001)
self.assertEqual(event["venue_address"], "San Jose, CA\r\nUSA")
self.assertEqual(event["location"], "San Jose, CA, USA")
self.assertEqual(event["event_short"], "ca2")
示例9: test_parse2012ct
def test_parse2012ct(self):
with open('test_data/usfirst_html/usfirst_event_details_2012ct.html', 'r') as f:
event = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "Northeast Utilities FIRST Connecticut Regional")
self.assertEqual(event["event_type"], "Regional")
self.assertEqual(event["start_date"], datetime.datetime(2012, 3, 29, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2012, 3, 31, 0, 0))
self.assertEqual(event["year"], 2012)
self.assertEqual(event["venue_address"], "Connecticut Convention Center\r\n100 Columbus Blvd\r\nHartford, CT 06103\r\nUSA")
self.assertEqual(event["website"], "http://www.ctfirst.org/ctr")
self.assertEqual(event["event_short"], "ct")
示例10: test_parse2005is
def test_parse2005is(self):
with open('test_data/usfirst_html/usfirst_event_details_2005is.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "GM/Technion University Israel Pilot Regional")
self.assertEqual(event["event_type_enum"], EventType.REGIONAL)
self.assertEqual(event["start_date"], datetime.datetime(2005, 3, 9, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2005, 3, 9, 0, 0))
self.assertEqual(event["year"], 2005)
self.assertEqual(event["venue_address"], "Haifa Sports Coliseum\r\nHaifa, Haifa\r\nIsrael")
self.assertEqual(event["venue"], "Haifa Sports Coliseum")
self.assertEqual(event["location"], "Haifa, Haifa, Israel")
self.assertEqual(event["event_short"], "is")
示例11: test_parse2005or
def test_parse2005or(self):
with open('test_data/usfirst_html/usfirst_event_details_2005or.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "Pacific Northwest Regional")
self.assertEqual(event["event_type_enum"], EventType.REGIONAL)
self.assertEqual(event["start_date"], datetime.datetime(2005, 3, 10, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2005, 3, 12, 0, 0))
self.assertEqual(event["year"], 2005)
self.assertEqual(event["venue_address"], "Memorial Coliseum\r\nPortland, OR 97201\r\nUSA")
self.assertEqual(event["venue"], "Memorial Coliseum")
self.assertEqual(event["location"], "Portland, OR, USA")
self.assertEqual(event["event_short"], "or")
示例12: test_parse_1997il
def test_parse_1997il(self):
with open('test_data/usfirst_html/usfirst_event_details_1997il.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "Motorola Midwest Regional")
self.assertEqual(event["event_type_enum"], EventType.REGIONAL)
self.assertEqual(event["start_date"], datetime.datetime(1997, 3, 6, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(1997, 3, 8, 0, 0))
self.assertEqual(event["year"], 1997)
self.assertEqual(event["venue_address"], "William Rainey Harper College\r\nChicago, IL\r\nUSA")
self.assertEqual(event["venue"], "William Rainey Harper College")
self.assertEqual(event["location"], "Chicago, IL, USA")
self.assertEqual(event["event_short"], "il")
示例13: test_parse2013casj
def test_parse2013casj(self):
with open('test_data/usfirst_html/usfirst_event_details_2013casj.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(event["name"], "Silicon Valley Regional")
self.assertEqual(event["event_type_enum"], EventType.REGIONAL)
self.assertEqual(event["start_date"], datetime.datetime(2013, 4, 4, 0, 0))
self.assertEqual(event["end_date"], datetime.datetime(2013, 4, 6, 0, 0))
self.assertEqual(event["year"], 2013)
self.assertEqual(event["venue_address"], "San Jose State University\r\nThe Event Center\r\nSan Jose, CA 95192\r\nUSA")
self.assertEqual(event["venue"], "San Jose State University")
self.assertEqual(event["location"], "San Jose, CA, USA")
self.assertEqual(event["website"], "http://www.firstsv.org")
self.assertEqual(event["event_short"], "casj")
示例14: test_2012ct_bad_location
def test_2012ct_bad_location(self):
with open('test_data/usfirst_html/usfirst_event_details_2012ct.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
event['location'] = "somewhere on mars"
self.assertEqual(EventHelper.get_timezone_id(event['location'], '{}{}'.format(event['year'], event['event_short'])), None)
示例15: test_1997il
def test_1997il(self):
with open('test_data/usfirst_html/usfirst_event_details_1997il.html', 'r') as f:
event, _ = UsfirstEventDetailsParser.parse(f.read())
self.assertEqual(EventHelper.get_timezone_id(event), 'America/Chicago')