def test_basics(self): p = TestPipeline() rows = (p | 'create' >> beam.Create([{ 'month': 1, 'day': 1, 'tornado': False }, { 'month': 1, 'day': 2, 'tornado': True }, { 'month': 1, 'day': 3, 'tornado': True }, { 'month': 2, 'day': 1, 'tornado': True }])) results = bigquery_tornadoes.count_tornadoes(rows) beam.assert_that( results, beam.equal_to([{ 'month': 1, 'tornado_count': 2 }, { 'month': 2, 'tornado_count': 1 }])) p.run().wait_until_finish()
def test_basics(self): with TestPipeline() as p: rows = (p | 'create' >> beam.Create([{ 'month': 1, 'day': 1, 'tornado': False }, { 'month': 1, 'day': 2, 'tornado': True }, { 'month': 1, 'day': 3, 'tornado': True }, { 'month': 2, 'day': 1, 'tornado': True }])) results = bigquery_tornadoes.count_tornadoes(rows) assert_that( results, equal_to([{ 'month': 1, 'tornado_count': 2 }, { 'month': 2, 'tornado_count': 1 }]))
def test_basics(self): with TestPipeline() as p: rows = (p | 'create' >> beam.Create([ {'month': 1, 'day': 1, 'tornado': False}, {'month': 1, 'day': 2, 'tornado': True}, {'month': 1, 'day': 3, 'tornado': True}, {'month': 2, 'day': 1, 'tornado': True}])) results = bigquery_tornadoes.count_tornadoes(rows) assert_that(results, equal_to([{'month': 1, 'tornado_count': 2}, {'month': 2, 'tornado_count': 1}]))
def test_basics(self): p = TestPipeline() rows = (p | 'create' >> beam.Create([ {'month': 1, 'day': 1, 'tornado': False}, {'month': 1, 'day': 2, 'tornado': True}, {'month': 1, 'day': 3, 'tornado': True}, {'month': 2, 'day': 1, 'tornado': True}])) results = bigquery_tornadoes.count_tornadoes(rows) assert_that(results, equal_to([{'month': 1, 'tornado_count': 2}, {'month': 2, 'tornado_count': 1}])) p.run().wait_until_finish()