Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test__filter_start_and_end_date(self):
# Arrange
data = copy.deepcopy(PYTHON_MINOR_DATA)
start_date = "2018-09-01"
end_date = "2018-09-11"
# Act
output = pypistats._filter(data, start_date=start_date, end_date=end_date)
# Assert
self.assertEqual(len(output), 112)
for row in output:
self.assertGreaterEqual(row["date"], start_date)
self.assertLessEqual(row["date"], end_date)
def test__filter_start_date(self):
# Arrange
data = copy.deepcopy(PYTHON_MINOR_DATA)
start_date = "2018-09-22"
# Act
output = pypistats._filter(data, start_date=start_date)
# Assert
self.assertEqual(len(output), 20)
for row in output:
self.assertGreaterEqual(row["date"], start_date)
def test__filter_no_filters_no_change(self):
# Arrange
data = copy.deepcopy(PYTHON_MINOR_DATA)
# Act
output = pypistats._filter(data)
# Assert
self.assertEqual(data, output)
def test__filter_end_date(self):
# Arrange
data = copy.deepcopy(PYTHON_MINOR_DATA)
end_date = "2018-04-22"
# Act
output = pypistats._filter(data, end_date=end_date)
# Assert
self.assertEqual(len(output), 62)
for row in output:
self.assertLessEqual(row["date"], end_date)