/usr/lib/python3/dist-packages/agate/testcase.py is in python3-agate 1.6.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/usr/bin/env python
try:
import unittest2 as unittest
except ImportError:
import unittest
import agate
class AgateTestCase(unittest.TestCase):
"""
Unittest case for quickly asserting logic about tables.
"""
def assertColumnNames(self, table, names):
"""
Verify the column names in the given table match what is expected.
"""
self.assertIsInstance(table, agate.Table)
self.assertSequenceEqual(table.column_names, names)
self.assertSequenceEqual(
[c.name for c in table.columns],
names
)
for row in table.rows:
self.assertSequenceEqual(
row.keys(),
names
)
def assertColumnTypes(self, table, types):
"""
Verify the column types in the given table are of the expected types.
"""
self.assertIsInstance(table, agate.Table)
table_types = table.column_types
column_types = [c.data_type for c in table.columns]
for i, test_type in enumerate(types):
self.assertIsInstance(table_types[i], test_type)
self.assertIsInstance(column_types[i], test_type)
def assertRows(self, table, rows):
"""
Verify the row data in the given table match what is expected.
"""
self.assertIsInstance(table, agate.Table)
for i, row in enumerate(rows):
self.assertSequenceEqual(table.rows[i], row)
def assertRowNames(self, table, names):
"""
Verify the row names in the given table match what is expected.
"""
self.assertIsInstance(table, agate.Table)
self.assertSequenceEqual(table.row_names, names)
self.assertSequenceEqual(
table.rows.keys(),
names
)
for column in table.columns:
self.assertSequenceEqual(
column.keys(),
names
)
|