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'))
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)
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()
def test_type(self): TEST_STATION = tc.Station('SCarolina', '8665530') self.assertIs(type(TEST_STATION), tc.Station)
def test_attributes(self): TEST_STATION = tc.Station('SCarolina', '8665530') self.assertEqual(str(TEST_STATION.site), 'SCarolina') self.assertEqual(str(TEST_STATION.station_number), '8665530')
def test_repr(self): TEST_STATION = tc.Station('SCarolina', '8665530') self.assertEqual(str(TEST_STATION), 'SCarolina, 8665530')