コード例 #1
0
ファイル: test_tsd.py プロジェクト: JeffAbrahamson/tsd
    def test_create_series(self):
        """Test create_series()."""
        tsd.create_series('tmp/non-diff', False, False)
        expected_sname = './test_data/tmp/non-diff'
        try:
            stat = os.stat(expected_sname)
            self.assertEqual(stat.st_size, 0)
        except OSError as err:
            print '{0}:  Create series error: {1}'.format(expected_sname, err)
            self.assertEqual('', err)

        tsd.create_series('tmp/diff', True, False)
        expected_diff_sname = './test_data/tmp/diff'
        try:
            stat = os.stat(expected_diff_sname)
            self.assertEqual(stat.st_size, 0)
        except OSError as err:
            print '{0}:  Create diff series error: {1}'.\
              format(expected_diff_sname, err)
            self.assertEqual('', err)
        try:
            stat = os.stat(expected_diff_sname + '.cfg')
            self.assertEqual(stat.st_size, 30)
        except OSError as err:
            print '{0}:  Create diff series config error: {1}'.\
              format(expected_diff_sname + '.cfg', err)
            self.assertEqual('', err)
コード例 #2
0
ファイル: test_tsd.py プロジェクト: JeffAbrahamson/tsd
 def test_show_series_config(self):
     """Test show_series_config()."""
     sname = 'tmp/for_its_config'
     # Create a diff series, which has a config
     tsd.create_series(sname, True, False)
     config_lines = tsd.show_series_config(sname)
     expected = 'diff_type=1\nconvolve_width=20\n'
     self.assertEqual(expected, config_lines)
コード例 #3
0
ファイル: test_tsd.py プロジェクト: JeffAbrahamson/tsd
 def test_add_point(self):
     """Test add_point()."""
     sname = 'tmp/add-points'
     tsd.create_series(sname, False, False)
     lines = tsd.recent_data(sname, True)
     self.assertEqual([], lines)
     tsd.add_point(sname, '2013-04-01', 3.1415)
     lines = tsd.recent_data(sname, True)
     self.assertEqual(['2013-04-01\t3.1415'], lines)