def test_no_dataset(self):
        """Ensure that render sources can handle no data sets."""
        from bigquery.query_builder import _render_sources

        result = _render_sources('', ['man', 'pig', 'bro'])

        self.assertEqual(result, 'FROM [.man], [.pig], [.bro]')
    def test_no_tables(self):
        """Ensure that render sources can handle no tables."""
        from bigquery.query_builder import _render_sources

        result = _render_sources('spider', [])

        self.assertEqual(result, 'FROM ')
    def test_multi_tables(self):
        """Ensure that render sources can handle multiple sources."""
        from bigquery.query_builder import _render_sources

        result = _render_sources('spider', ['man', 'pig', 'bro'])

        self.assertEqual(
            result, 'FROM [spider.man], [spider.pig], [spider.bro]')
    def test_tables_in_date_range(self):
        """Ensure that render sources can handle tables in DATE RANGE."""

        tables = {
            'date_range': True,
            'from_date': '2015-08-23',
            'to_date': '2015-10-10',
            'table': 'pets_'
        }

        result = _render_sources('animals', tables)

        self.assertEqual(result, "FROM (TABLE_DATE_RANGE([animals.pets_], "
                         "TIMESTAMP('2015-08-23'), TIMESTAMP('2015-10-10'))) ")
    def test_no_tables(self):
        """Ensure that render sources can handle no tables."""

        result = _render_sources('spider', [])

        self.assertEqual(result, 'FROM ')