Guido Draheim avatar Guido Draheim committed 07c2ec2

adjustments on logg for unittests

Comments (0)

Files changed (2)

src/dvbcronrecording/computer.py

         self.extratimeM = None
         self.adapter = None
     def __unicode__(self):
-        return u"[%s]" % (u",".join([unicode(item) for item in self.items]))
+        return u"[%s]" % (u",\n  ".join([unicode(item) for item in self.items]))
     def __str__(self):
         return unicode(self)
 
         self._groups = groups
     def __unicode__(self):
         groups = [unicode(item) for item in self._groups]
-        return u"{%s}" % (u",".join(groups))
+        return u"\n{%s}" % (u",\n ".join(groups))
     def __str__(self):
         return unicode(self)
 
         return None
     
     def get_allowed_months(self, ahead = months_ahead):
-        this_month = time.localtime().tm_mon
+        this_month = self.localtime().tm_mon
         allowed = []
         for add_months in xrange(months_ahead):
             month = this_month + add_months
         return allowed
     
     def get_past_days_this_month(self):
-        today = time.localtime()
+        today = self.localtime()
         this_month = today.tm_mon
         this_day = today.tm_mday
         allowed = []
         self.logg.debug("onlymonths %s", onlymonths)
         regularmonths = [ month for month in xrange(1,13) if month not in onlymonths ]
         self.logg.debug("regularmonths %s", regularmonths)
-        localtime = time.localtime()
+        localtime = self.localtime()
         this_month = localtime.tm_mon
         this_year = localtime.tm_year
         past_days = self.get_past_days_this_month()
         return plan
     def recordinglist_to_flat_recorderitems(self, entries, ahead = months_ahead):
         recorderitems = list(self.recordinglist_to_recorderitems(entries, ahead))
-        localtime = time.localtime()
+        localtime = self.localtime()
         this_month = localtime.tm_mon
         this_year = localtime.tm_year
         past_days = self.get_past_days_this_month()
         return plan
     def recordinglist_to_recordertimelist(self, entries, ahead = months_ahead):
         recorderitems = list(self.recordinglist_to_recorderitems(entries, ahead))
-        localtime = time.localtime()
+        localtime = self.localtime()
         this_month = localtime.tm_mon
         this_year = localtime.tm_year
         past_days = self.get_past_days_this_month()

src/tests/computer_test.py

         a = Entry("ard","ard1","22:30","23:30","0", "6", "", "ok")
         req = Request(Locale("de"))
         res = self.computer.plan4(req, [a])
-        self.logg.info("\n%s", res)
-        E = u"{[{  [22:30-23:30]+0 ard@0 None([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])6 'ard1' }]}"
+        self.logg.info("RESULT:%s", res)
+        E = u"""
+{[{  [22:30-23:30]+0 ard@0 None([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])6 'ard1' }]}"""
         self.assertEqual(unicode(res), E)
     def test_04_entries(self):
         a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
         req = Request(Locale("de"))
         res = self.computer.plan4(req, [a])
-        self.logg.info("\n%s", res)
-        E = u"{[{  ard[22:30-23:30]0@0 22([4])6 'ard1' }]}"
+        self.logg.info("RESULT:%s", res)
+        E = u"""
+{[{  [22:30-23:30]+0 ard@0 22([4])6 'ard1' }]}"""
         self.assertEqual(unicode(res), E)
     def test_10_2entries_samegroupandcontinue(self):
         a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
         b = Entry("ard","ard1","23:30","00:30","0", "", "22.04.", "ok")
         req = Request(Locale("de"))
         res = self.computer.plan4(req, [a, b])
-        self.logg.info("\n%s", res)
-        E = u"{[{  ard[22:30-23:30]0@0 22([4])6 'ard1' },{  ard[23:30-00:30]0@0 22([4])6 'ard1' }]}"
+        self.logg.info("RESULT:%s", res)
+        E = u"""
+{[{  [22:30-23:30]+0 ard@0 22([4])6 'ard1' },
+  {  [23:30-00:30]+0 ard@0 22([4])6 'ard1' }]}"""
         self.assertEqual(unicode(res), E)
     def test_11_2entries_differentgroups(self):
         a = Entry("ard","ard1","22:30","23:30","0", "", "22.04.", "ok")
         b = Entry("ard","ard1","23:33","00:33","0", "", "22.04.", "ok")
         req = Request(Locale("de"))
         res = self.computer.plan4(req, [a, b])
-        self.logg.info("\n%s", res)
-        E = u"{[{  ard[22:30-23:30]0@0 22([4])6 'ard1' }],[{  ard[23:33-00:33]0@0 22([4])6 'ard1' }]}"
+        self.logg.info("RESULT:%s", res)
+        E = u"""
+{[{  [22:30-23:30]+0 ard@0 22([4])6 'ard1' }],
+ [{  [23:33-00:33]+0 ard@0 22([4])6 'ard1' }]}"""
         self.assertEqual(unicode(res), E)
 
 if __name__ == "__main__":
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.