Пример #1
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(),
     )
Пример #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)
Пример #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(),
     )
Пример #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)
Пример #5
0
 def test_make_sessions(self):
     atoms = watson.log_file_to_atoms("testinputs/regressions/livenotes.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 36)
Пример #6
0
 def test_get_sessions_works_with_no_atoms(self):
     atoms = []
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 0)
Пример #7
0
 def test_make_email_sessions(self):
     atoms = watson.desktop_tracking_file_to_atoms("testinputs/desktop.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 2)
Пример #8
0
 def test_split_on_title(self):
     atoms = watson.log_file_to_atoms("testinputs/splitontitle.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 9)
Пример #9
0
 def test_log_file_to_atoms_problem(self):
     atoms = watson.log_file_to_atoms("testinputs/problem.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 0)
Пример #10
0
    def test_log_file_to_atoms_inline_wrong(self):
        atoms = watson.log_file_to_atoms("testinputs/wrong.md")
        print atoms[0]
        sessions = watson.get_sessions(atoms)

        self.assertEqual(len(atoms), 1)
Пример #11
0
 def test_midnight_bug(self):
     atoms = watson.log_file_to_atoms("testinputs/midnight.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 1)
Пример #12
0
 def test_journal_bug(self):
     atoms = watson.log_file_to_atoms("testinputs/strange.md")
     sessions = watson.get_sessions(atoms)
     self.assertEqual(len(sessions), 1)
Пример #13
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)