|
19 | 19 |
|
20 | 20 |
|
21 | 21 | class DataSourceFieldsTDS(unittest.TestCase):
|
| 22 | + |
22 | 23 | def setUp(self):
|
23 | 24 | self.ds = Datasource.from_file(TEST_TDS_FILE)
|
24 | 25 |
|
@@ -51,21 +52,31 @@ def test_datasource_field_is_quantitative(self):
|
51 | 52 | def test_datasource_field_is_ordinal(self):
|
52 | 53 | self.assertTrue(self.ds.fields['[x]'].is_ordinal)
|
53 | 54 |
|
| 55 | + def test_datasource_field_datatype(self): |
| 56 | + self.assertEqual(self.ds.fields['[x]'].datatype, 'integer') |
| 57 | + |
| 58 | + def test_datasource_field_role(self): |
| 59 | + self.assertEqual(self.ds.fields['[x]'].role, 'measure') |
| 60 | + |
54 | 61 |
|
55 | 62 | class DataSourceFieldsTWB(unittest.TestCase):
|
| 63 | + |
56 | 64 | def setUp(self):
|
57 | 65 | self.wb = Workbook(TEST_TWB_FILE)
|
58 |
| - self.ds = self.wb.datasources[0] # Assume the first datasource in the file |
| 66 | + # Assume the first datasource in the file |
| 67 | + self.ds = self.wb.datasources[0] |
59 | 68 |
|
60 | 69 | def test_datasource_fields_loaded_in_workbook(self):
|
61 | 70 | self.assertIsNotNone(self.ds.fields)
|
62 | 71 | self.assertIsNotNone(self.ds.fields.get('[Number of Records]', None))
|
63 | 72 |
|
64 | 73 |
|
65 | 74 | class DataSourceFieldsFoundIn(unittest.TestCase):
|
| 75 | + |
66 | 76 | def setUp(self):
|
67 | 77 | self.wb = Workbook(TEST_TWB_FILE)
|
68 |
| - self.ds = self.wb.datasources[0] # Assume the first datasource in the file |
| 78 | + # Assume the first datasource in the file |
| 79 | + self.ds = self.wb.datasources[0] |
69 | 80 |
|
70 | 81 | def test_datasource_fields_found_in_returns_fields(self):
|
71 | 82 | actual_values = self.ds.fields.used_by_sheet('Sheet 1')
|
|
0 commit comments