コード例 #1
0
 def test_type(self):
     TEST_STATION = tc.Station('SCarolina', '8665530')
     TODAY = tc.Date(datetime.datetime.now().day,
                     datetime.datetime.now().month,
                     datetime.datetime.now().year)
     TEST_TIDES = tc.Tides(TEST_STATION, TODAY)
     self.assertIs(type(TEST_TIDES), tc.Tides)
コード例 #2
0
 def test_attributes(self):
     TEST_STATION = tc.Station('SCarolina', '8665530')
     TODAY = tc.Date(datetime.datetime.now().day,
                     datetime.datetime.now().month,
                     datetime.datetime.now().year)
     TEST_TIDES = tc.Tides(TEST_STATION, TODAY)
     self.assertEqual(str(TEST_TIDES.station),
                      str(tc.Station('SCarolina', '8665530')))
     self.assertEqual(str(TEST_TIDES.date), str(TODAY))
     self.assertTrue(hasattr(TEST_TIDES, 'tides'))
     self.assertTrue(hasattr(TEST_TIDES, 'graph'))
コード例 #3
0
 def test_send_email(self):
     NOW = datetime.datetime.now()
     DATE = tc.Date(NOW.day, NOW.month, NOW.year)
     TIDES = tc.Tides(tc.Station('SCarolina', '8665099'), DATE)
     SUBJECT = 'Tides for %s' % (str(DATE))
     BODY = str(TIDES.tides)
     with open('email.info', 'r+') as FILE:
         INFO = FILE.readlines()
     EMAIL_INFO = tc.EmailInfo(INFO[0], INFO[1], INFO[2])
     EMAIL = tc.Email(EMAIL_INFO, SUBJECT, BODY)
     EMAIL.attach(TIDES.station.site + '.png', TIDES.graph)
     EMAIL.send()
コード例 #4
0
 def test_repr(self):
     TEST_DATE = tc.Date(1, 2, 2016)
     self.assertEqual(str(TEST_DATE), '1 2 2016')
コード例 #5
0
 def test_type(self):
     TODAY = tc.Date(datetime.datetime.now().day,
                     datetime.datetime.now().month,
                     datetime.datetime.now().year)
     self.assertIs(type(TODAY), tc.Date)
コード例 #6
0
 def test_attributes(self):
     TEST_DATE = tc.Date(4, 20, 2015)
     self.assertEqual(TEST_DATE.day, 4)
     self.assertEqual(TEST_DATE.month, 20)
     self.assertEqual(TEST_DATE.year, 2015)