forked from AccesoGroup/document-api-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_field.py
More file actions
29 lines (22 loc) · 755 Bytes
/
test_field.py
File metadata and controls
29 lines (22 loc) · 755 Bytes
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
import unittest
import os.path
from tableaudocumentapi import Datasource, Field
from tableaudocumentapi.field import _find_metadata_record
TEST_ASSET_DIR = os.path.join(
os.path.dirname(__file__),
'assets'
)
TEST_TDS_FILE = os.path.join(
TEST_ASSET_DIR,
'datasource_test.tds'
)
class FieldsUnitTest(unittest.TestCase):
def test_field_throws_if_no_data_passed_in(self):
with self.assertRaises(AttributeError):
Field()
class FindMetaDataRecordEdgeTest(unittest.TestCase):
class MockXmlWithNoFind(object):
def find(self, *args, **kwargs):
return None
def test_find_metadata_record_returns_none(self):
self.assertIsNone(_find_metadata_record(self.MockXmlWithNoFind(), 'foo'))