예제 #1
0
파일: test_gbq.py 프로젝트: akloster/pandas
 def test_type_conversion(self):
     # All BigQuery Types should be cast into appropriate numpy types
     sample_input = [('1.095292800E9', 'TIMESTAMP'),
              ('false', 'BOOLEAN'),
              ('2', 'INTEGER'),
              ('3.14159', 'FLOAT'),
              ('Hello World', 'STRING')]
     actual_output = [gbq._parse_entry(result[0],result[1]) for result in sample_input]
     sample_output = [np.datetime64('2004-09-16T00:00:00.000000Z'),
               np.bool(False),
               np.int('2'),
               np.float('3.14159'),
               'Hello World']
     self.assertEqual(actual_output, sample_output, 'A format conversion failed')
예제 #2
0
파일: test_gbq.py 프로젝트: ARF1/pandas
 def test_should_return_bigquery_strings_as_python_strings(self):
     result = gbq._parse_entry('STRING', 'STRING')
     tm.assert_equal(result, 'STRING')
예제 #3
0
파일: test_gbq.py 프로젝트: ARF1/pandas
 def test_should_return_bigquery_booleans_as_python_booleans(self):
     result = gbq._parse_entry('false', 'BOOLEAN')
     tm.assert_equal(result, False)
예제 #4
0
파일: test_gbq.py 프로젝트: ARF1/pandas
 def test_should_return_bigquery_timestamps_as_numpy_datetime(self):
     result = gbq._parse_entry('0e9', 'TIMESTAMP')
     tm.assert_equal(result, np.datetime64('1970-01-01T00:00:00Z'))
예제 #5
0
파일: test_gbq.py 프로젝트: ARF1/pandas
 def test_should_return_bigquery_floats_as_python_floats(self):
     result = gbq._parse_entry(1, 'FLOAT')
     tm.assert_equal(result, float(1))
예제 #6
0
파일: test_gbq.py 프로젝트: ARF1/pandas
 def test_should_return_bigquery_integers_as_python_floats(self):
     result = gbq._parse_entry(1, 'INTEGER')
     tm.assert_equal(result, float(1))
예제 #7
0
파일: test_gbq.py 프로젝트: cscanlin/pandas
 def test_should_return_bigquery_timestamps_as_numpy_datetime(self):
     result = gbq._parse_entry("0e9", "TIMESTAMP")
     tm.assert_equal(result, np.datetime64("1970-01-01T00:00:00Z"))
예제 #8
0
 def test_should_return_bigquery_booleans_as_python_booleans(self):
     result = gbq._parse_entry('false', 'BOOLEAN')
     tm.assert_equal(result, False)
예제 #9
0
 def test_should_return_bigquery_timestamps_as_numpy_datetime(self):
     result = gbq._parse_entry('0e9', 'TIMESTAMP')
     tm.assert_equal(result, np.datetime64('1970-01-01T00:00:00Z'))
예제 #10
0
 def test_should_return_bigquery_floats_as_python_floats(self):
     result = gbq._parse_entry(1, 'FLOAT')
     tm.assert_equal(result, float(1))
예제 #11
0
 def test_should_return_bigquery_integers_as_python_floats(self):
     result = gbq._parse_entry(1, 'INTEGER')
     tm.assert_equal(result, float(1))
예제 #12
0
 def test_should_return_bigquery_strings_as_python_strings(self):
     result = gbq._parse_entry('STRING', 'STRING')
     tm.assert_equal(result, 'STRING')