From d3a612109a2f1d6d625e1b935c8fb507dc40e9c2 Mon Sep 17 00:00:00 2001 From: Anahita Bhiwandiwalla Date: Mon, 21 Sep 2015 15:12:23 -0700 Subject: [PATCH 1/2] Added integration test for column summary statistic --- .../tests/frame_column_summary_statistics.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 integration-tests/tests/frame_column_summary_statistics.py diff --git a/integration-tests/tests/frame_column_summary_statistics.py b/integration-tests/tests/frame_column_summary_statistics.py new file mode 100644 index 0000000000..95caf30c83 --- /dev/null +++ b/integration-tests/tests/frame_column_summary_statistics.py @@ -0,0 +1,45 @@ +# +# Copyright (c) 2015 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import unittest +import trustedanalytics as ta + +# show full stack traces +ta.errors.show_details = True +ta.loggers.set_api() +# TODO: port setup should move to a super class +if ta.server.port != 19099: + ta.server.port = 19099 +ta.connect() + +class FrameColumnSummaryStatisticsTest(unittest.TestCase): + def testColumnSummaryStatistics(self): + print "define csv file" + csv = ta.CsvFile("/datasets/dates.csv", schema= [('start', ta.datetime), ('id', int), ('stop', ta.datetime), + ('color', str)], delimiter=',') + + print "create frame" + frame = ta.Frame(csv) + + print "Calling column summary statistics" + stats = frame.column_summary_statistics("id") + self.assertEqual(stats['maximum'], 4.0) + self.asserEqual(stats['variance'], 2.5) + + + +if __name__ == "__main__": + unittest.main() From 9f4fbd134dba15bf015c899289feb2d79c38633c Mon Sep 17 00:00:00 2001 From: Anahita Bhiwandiwalla Date: Mon, 12 Oct 2015 10:47:07 -0700 Subject: [PATCH 2/2] Rerun colum_summary_statistics integration test --- .../tests/frame_column_summary_statistics.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/integration-tests/tests/frame_column_summary_statistics.py b/integration-tests/tests/frame_column_summary_statistics.py index 95caf30c83..df2ddb8710 100644 --- a/integration-tests/tests/frame_column_summary_statistics.py +++ b/integration-tests/tests/frame_column_summary_statistics.py @@ -25,19 +25,23 @@ ta.server.port = 19099 ta.connect() -class FrameColumnSummaryStatisticsTest(unittest.TestCase): - def testColumnSummaryStatistics(self): +class FrameColumnSummaryStatisticsTestNew(unittest.TestCase): + def testColumnSummaryStatisticsNew(self): print "define csv file" csv = ta.CsvFile("/datasets/dates.csv", schema= [('start', ta.datetime), ('id', int), ('stop', ta.datetime), - ('color', str)], delimiter=',') + ('color', str)], delimiter=',') + + name = "update_last_read" + if name in ta.get_frame_names(): + ta.drop_frames(name) print "create frame" - frame = ta.Frame(csv) + frame = ta.Frame(csv, name=name) print "Calling column summary statistics" stats = frame.column_summary_statistics("id") self.assertEqual(stats['maximum'], 4.0) - self.asserEqual(stats['variance'], 2.5) + self.assertEqual(stats['variance'], 2.5)