Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename assert_equals to assert_equal #119

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/common/index_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ def update_indexes(start_date, end_date):
if (today - k).days <=5 or k.day in [25, 26, 27, 28, 29, 30, 31, 1, 2, 3, 4, 5]:
add_hip(index, k, v)
elif abs((v-last_val)*100/(last_val+1)) > 1:
add_hip(index, k, v)
add_hip(index, k, v)
last_val = v
except Exception as ex:
print(f'exception {ex} when updating index {index.country}/{index.name}')

def update_index(exchange, start_date, end_date):
today = datetime.date.today()
symbol, country = get_comp_index(exchange)
if symbol:
try:
Expand All @@ -65,10 +66,10 @@ def update_index(exchange, start_date, end_date):
yf.close()
last_val = 0
for k,v in response.items():
if k.day in [25, 26, 27, 28, 29, 30, 31, 1, 2, 3, 4, 5]:
if (today - k).days <=5 or k.day in [25, 26, 27, 28, 29, 30, 31, 1, 2, 3, 4, 5]:
add_hip(index, k, v)
elif abs((v-last_val)*100/(last_val+1)) > 1:
add_hip(index, k, v)
add_hip(index, k, v)
last_val = v

def add_hip(index, date, points):
Expand Down Expand Up @@ -128,11 +129,11 @@ def get_comp_index_values(stock, start_date, last_date):

if first_missing and first_found and (first_found - first_missing).days > 15:
print(f'from get_comp_index_values: first_missing {first_missing} first_found {first_found}')
update_index_points(stock.exchange, first_missing, first_found)
update_index_points(stock.exchange, first_found, first_missing)

if last_missing and last_found and (last_missing - last_found).days > 15:
print(f'from get_comp_index_values: last_missing {last_missing} last_found {last_found}')
update_index_points(stock.exchange, last_missing, last_found)
update_index_points(stock.exchange, last_found, last_missing)

if not first_found and not last_found:
print(f'from get_comp_index_values: first_found {first_found} last_found {last_found}')
Expand Down
22 changes: 11 additions & 11 deletions src/retirement_401k/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,17 @@ def test_add_account(self):
self.assertEqual(len(rows), 1)
columns = rows[0].find_elements(By.TAG_NAME, 'td')
anc = columns[0].find_elements(By.TAG_NAME, 'a')
self.assertEquals(anc[0].text, 'Personal')
self.assertEquals(columns[1].text, 'Oct. 4, 2010')
self.assertEqual(anc[0].text, 'Personal')
self.assertEqual(columns[1].text, 'Oct. 4, 2010')
time.sleep(5)
self.assertEquals(columns[2].text, 'None')
self.assertEquals(columns[3].text, user.name)
self.assertEquals(columns[4].text, '')
self.assertEquals(columns[5].text, '0.00')
self.assertEquals(columns[6].text, '0.00')
self.assertEquals(columns[7].text, '0.00')
self.assertEquals(columns[8].text, 'None')
self.assertEquals(columns[9].text, '0.00')
self.assertEqual(columns[2].text, 'None')
self.assertEqual(columns[3].text, user.name)
self.assertEqual(columns[4].text, '')
self.assertEqual(columns[5].text, '0.00')
self.assertEqual(columns[6].text, '0.00')
self.assertEqual(columns[7].text, '0.00')
self.assertEqual(columns[8].text, 'None')
self.assertEqual(columns[9].text, '0.00')

trans = columns[10].find_element(By.XPATH, "./a[contains(@href,'transactions')]")
trans.click()
Expand All @@ -110,4 +110,4 @@ def test_add_account(self):
'''
source venv/bin/activate
python manage.py test retirement_401k
'''
'''
Loading