Skip to content

Commit

Permalink
Updating tests and setup files to latest version of black.
Browse files Browse the repository at this point in the history
  • Loading branch information
coddingtonbear committed Feb 3, 2021
1 parent 68a3ed4 commit ab4dc6a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
packages=find_packages(),
install_requires=requirements,
test_suite="nose.collector",
tests_require=["nose", "mock",],
tests_require=[
"nose",
"mock",
],
entry_points={"console_scripts": ["myfitnesspal = myfitnesspal.cmdline:main"]},
)
49 changes: 33 additions & 16 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,26 @@ def test_get_measurement_ids(self):
}

self.assertEqual(
expected_ids, actual_ids,
expected_ids,
actual_ids,
)

def test_get_meals(self):
document = self.get_html_document("diary.html")
meals = self.client._get_meals(document)

self.assertEqual(
len(meals), 4,
len(meals),
4,
)

def test_get_measurements(self):
with patch.object(self.client, "_get_document_for_url") as get_doc:
get_doc.return_value = self.get_html_document("measurements.html")
actual_measurements = self.client.get_measurements(
"Body Fat", self.arbitrary_date1, self.arbitrary_date2,
"Body Fat",
self.arbitrary_date1,
self.arbitrary_date2,
)

expected_measurements = OrderedDict(
Expand All @@ -68,7 +72,8 @@ def test_get_measurements(self):
)

self.assertEqual(
expected_measurements, actual_measurements,
expected_measurements,
actual_measurements,
)

def test_get_day_unit_unaware(self):
Expand Down Expand Up @@ -172,13 +177,16 @@ def test_get_day_unit_unaware(self):
actual_dict = day.get_as_dict()

self.assertEqual(
expected_dict, actual_dict,
expected_dict,
actual_dict,
)
self.assertEqual(
day.date, self.arbitrary_date1,
day.date,
self.arbitrary_date1,
)
self.assertEqual(
day.complete, False,
day.complete,
False,
)
self.assertEqual(
day.goals,
Expand Down Expand Up @@ -304,13 +312,16 @@ def test_get_day(self):
actual_dict = day.get_as_dict()

self.assertEqual(
expected_dict, actual_dict,
expected_dict,
actual_dict,
)
self.assertEqual(
day.date, self.arbitrary_date1,
day.date,
self.arbitrary_date1,
)
self.assertEqual(
day.complete, False,
day.complete,
False,
)
self.assertEqual(
day.goals,
Expand Down Expand Up @@ -356,17 +367,20 @@ def test_get_exercise(self):

# The returned object should be an array of length 2
self.assertEqual(
len(day), 2,
len(day),
2,
)

# The first object of the array should be our cardio
self.assertEqual(
day[0].name, "cardiovascular",
day[0].name,
"cardiovascular",
)

# The second object should be our strength training
self.assertEqual(
day[1].name, "strength training",
day[1].name,
"strength training",
)

expected_cardio = [
Expand Down Expand Up @@ -399,11 +413,13 @@ def test_get_exercise(self):
actual_strength = day[1].get_as_list()

self.assertEqual(
expected_cardio, actual_cardio,
expected_cardio,
actual_cardio,
)

self.assertEqual(
expected_strength, actual_strength,
expected_strength,
actual_strength,
)

def test_get_completed_day(self):
Expand All @@ -412,5 +428,6 @@ def test_get_completed_day(self):
day = self.client.get_date(self.arbitrary_date1)

self.assertEqual(
day.complete, True,
day.complete,
True,
)
5 changes: 4 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def setUpClass(cls):
pytest.skip("Integration testing account not set in this environment.")
return

cls.client = Client(username, password,)
cls.client = Client(
username,
password,
)

day_with_known_entries = datetime.date(2020, 7, 4)

Expand Down

0 comments on commit ab4dc6a

Please sign in to comment.