Ejemplo n.º 1
0
 def test_time_split(self):
     TF = "%d-%b-%Y %H:%M"
     atoms = watson.heartrate_to_atoms("testinputs/heartshort.csv")
     start = "02-Jan-2017 12:27"
     end = "02-Jan-2017 16:27"
     atoms = watson.cut(atoms, start, end)
     self.assertEqual(len(atoms), 1036)
Ejemplo n.º 2
0
 def test_invert_sessions(self):
     pre = watson.max_dist_between_logs
     watson.max_dist_between_logs = 90
     atoms = watson.heartrate_to_atoms("testinputs/heartshort.csv")
     sessions = watson.get_sessions(atoms)
     #print "XXX{}".format(sessions[0])
     sessions = watson.invert_sessions(sessions)
     watson.max_dist_between_logs = pre
     projects = list(set([entry.project for entry in sessions]))
     #   for project in projects:
     #           watson.projectreport(project, sessions, True)
     self.assertEqual(len(sessions), 140)
Ejemplo n.º 3
0
 def test_sleep_regression(self):
     watson.args = lambda: None
     setattr(watson.args, 'action', 'sort')
     setattr(watson.args, 'd', None)
     setattr(watson.args, 'verbatim', None)
     TF = "%d-%b-%Y %H:%M"
     atoms = watson.heartrate_to_atoms("testinputs/heart.csv")
     atoms = watson.get_atom_clusters(atoms)
     sessions = watson.get_sessions(atoms)
     watson.calendar_output('testoutputs/sleepregression.ics', sessions)
     self.maxDiff = None
     self.assertMultiLineEqual(
         open('testoutputs/sleepregression.ics').read().strip(),
         open('testinputs/sleepregression.ics').read().strip(),
     )
Ejemplo n.º 4
0
    def test_count_awake_sessions(self):
        watson.args = lambda: None
        setattr(watson.args, 'action', 'sort')
        setattr(watson.args, 'd', None)
        setattr(watson.args, 'verbatim', None)
        TF = "%d-%b-%Y %H:%M"
        pre = watson.max_dist_between_logs
        watson.max_dist_between_logs = 90
        atoms = watson.heartrate_to_atoms("testinputs/heartshort.csv")
        sessions = watson.get_sessions(atoms)
        watson.max_dist_between_logs = pre
        projects = list(set([entry.project for entry in sessions]))
        # for project in projects:
        #         watson.projectreport(project, sessions, True)

        self.assertEqual(len(sessions), 140)
Ejemplo n.º 5
0
 def test_selective_calendar_write(self):
     TF = "%d-%b-%Y %H:%M"
     atoms = watson.heartrate_to_atoms("testinputs/heartshort.csv")
     atoms = watson.get_atom_clusters(atoms)
     sessions = watson.get_sessions(atoms)
     email_atoms = watson.desktop_tracking_file_to_atoms(
         "testinputs/desktop.md")
     email_sessions = watson.get_sessions(email_atoms)
     sessions.extend(email_sessions)
     watson.calendar_output('testoutputs/exerciseSelective.ics', sessions,
                            'Exercise')
     self.maxDiff = None
     self.assertMultiLineEqual(
         open('testoutputs/exerciseSelective.ics').read().strip(),
         open('testinputs/exercise.ics').read().strip(),
     )
Ejemplo n.º 6
0
 def test_read_heartrate_file(self):
     atoms = watson.heartrate_to_atoms("testinputs/heart.csv")
     self.assertEqual(len(atoms), 164866)
Ejemplo n.º 7
0
 def test_get_exercise_sessions(self):
     TF = "%d-%b-%Y %H:%M"
     atoms = watson.heartrate_to_atoms("testinputs/heartshort.csv")
     atoms = watson.get_atom_clusters(atoms)
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 58)