Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
| category | date | downloads |
|----------|------------|----------:|
| 2.6 | 2018-08-15 | 51 |
| 2.7 | 2018-08-15 | 63,749 |
| 3.2 | 2018-08-15 | 2 |
| 3.3 | 2018-08-15 | 40 |
| 3.4 | 2018-08-15 | 6,095 |
| 3.5 | 2018-08-15 | 20,358 |
| 3.6 | 2018-08-15 | 35,274 |
| 3.7 | 2018-08-15 | 6,595 |
| 3.8 | 2018-08-15 | 3 |
| null | 2018-08-15 | 1,019 |
"""
# Act
output = pypistats._tabulate(data, format="markdown")
# Assert
self.assertEqual(output.strip(), expected_output.strip())
| category | date | downloads |
|----------|------------|----------:|
| 2.6 | 2018-08-15 | 51 |
| 2.7 | 2018-08-15 | 63,749 |
| 3.2 | 2018-08-15 | 2 |
| 3.3 | 2018-08-15 | 40 |
| 3.4 | 2018-08-15 | 6,095 |
| 3.5 | 2018-08-15 | 20,358 |
| 3.6 | 2018-08-15 | 35,274 |
| 3.7 | 2018-08-15 | 6,595 |
| 3.8 | 2018-08-15 | 3 |
| null | 2018-08-15 | 1,019 |
"""
# Act
output = pypistats._tabulate(data)
# Assert
self.assertEqual(output.strip(), expected_output.strip())
def test_versions_are_strings(self):
# Arrange
data = copy.deepcopy(SAMPLE_DATA_VERSION_STRINGS)
expected_output = """
| category | date | downloads |
|----------|------------|----------:|
| 3.1 | 2018-08-15 | 10 |
| 3.10 | 2018-08-15 | 1 |
"""
# Act
output = pypistats._tabulate(data, format="markdown")
# Assert
self.assertEqual(output.strip(), expected_output.strip())
========== ============ ===========
2.6 2018-08-15 51
2.7 2018-08-15 63,749
3.2 2018-08-15 2
3.3 2018-08-15 40
3.4 2018-08-15 6,095
3.5 2018-08-15 20,358
3.6 2018-08-15 35,274
3.7 2018-08-15 6,595
3.8 2018-08-15 3
null 2018-08-15 1,019
========== ============ ===========
""" # noqa: W291
# Act
output = pypistats._tabulate(data, format="rst")
# Assert
self.assertEqual(output.strip(), expected_output.strip())
3.8
2018-08-15
3
null
2018-08-15
1,019
"""
# Act
output = pypistats._tabulate(data, format="html")
# Assert
self.assertEqual(output.strip(), expected_output.strip())