Skip to content

Commit 9024b35

Browse files
committed
test(all): run yapf on all integration tests
1 parent c121953 commit 9024b35

8 files changed

+282
-221
lines changed

test/integration/test_compare_comply_v1.py

Lines changed: 64 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,17 @@
77
from ibm_watson.compare_comply_v1 import TableReturn
88

99

10-
@pytest.mark.skipif(
11-
os.getenv('VCAP_SERVICES') is None, reason='requires VCAP_SERVICES')
10+
@pytest.mark.skipif(os.getenv('VCAP_SERVICES') is None,
11+
reason='requires VCAP_SERVICES')
1212
class IntegrationTestCompareComplyV1(TestCase):
1313
compare_comply = None
1414

1515
@classmethod
1616
def setup_class(cls):
17-
cls.compare_comply = ibm_watson.CompareComplyV1(
18-
'2018-10-15')
17+
cls.compare_comply = ibm_watson.CompareComplyV1('2018-10-15')
1918
cls.compare_comply.set_default_headers({
20-
'X-Watson-Learning-Opt-Out':
21-
'1',
22-
'X-Watson-Test':
23-
'1'
19+
'X-Watson-Learning-Opt-Out': '1',
20+
'X-Watson-Test': '1'
2421
})
2522

2623
def test_convert_to_html(self):
@@ -32,7 +29,8 @@ def test_convert_to_html(self):
3229
def test_classify_elements(self):
3330
contract = abspath('resources/contract_A.pdf')
3431
with open(contract, 'rb') as file:
35-
result = self.compare_comply.classify_elements(file, file_content_type='application/pdf').get_result()
32+
result = self.compare_comply.classify_elements(
33+
file, file_content_type='application/pdf').get_result()
3634
assert result is not None
3735

3836
def test_extract_tables(self):
@@ -45,102 +43,97 @@ def test_extract_tables(self):
4543
def test_compare_documents(self):
4644
with open(os.path.join(os.path.dirname(__file__), '../../resources/contract_A.pdf'), 'rb') as file1, \
4745
open(os.path.join(os.path.dirname(__file__), '../../resources/contract_B.pdf'), 'rb') as file2:
48-
result = self.compare_comply.compare_documents(file1, file2).get_result()
46+
result = self.compare_comply.compare_documents(file1,
47+
file2).get_result()
4948

5049
assert result is not None
5150

5251
@pytest.mark.skip(reason="Temporarily skip")
5352
def test_feedback(self):
5453
feedback_data = {
55-
'feedback_type': 'element_classification',
54+
'feedback_type':
55+
'element_classification',
5656
'document': {
5757
'hash': '',
5858
'title': 'doc title'
5959
},
60-
'model_id': 'contracts',
61-
'model_version': '11.00',
60+
'model_id':
61+
'contracts',
62+
'model_version':
63+
'11.00',
6264
'location': {
6365
'begin': '214',
6466
'end': '237'
6567
},
66-
'text': '1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing infrastructure.',
68+
'text':
69+
'1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing infrastructure.',
6770
'original_labels': {
68-
'types': [
69-
{
70-
'label': {
71-
'nature': 'Obligation',
72-
'party': 'IBM'
73-
},
74-
'provenance_ids': [
75-
'85f5981a-ba91-44f5-9efa-0bd22e64b7bc',
76-
'ce0480a1-5ef1-4c3e-9861-3743b5610795'
77-
]
71+
'types': [{
72+
'label': {
73+
'nature': 'Obligation',
74+
'party': 'IBM'
7875
},
79-
{
80-
'label': {
81-
'nature': 'End User',
82-
'party': 'Exclusion'
83-
},
84-
'provenance_ids': [
85-
'85f5981a-ba91-44f5-9efa-0bd22e64b7bc',
86-
'ce0480a1-5ef1-4c3e-9861-3743b5610795'
87-
]
88-
}
89-
],
90-
'categories': [
91-
{
92-
'label': 'Responsibilities',
93-
'provenance_ids': []
76+
'provenance_ids': [
77+
'85f5981a-ba91-44f5-9efa-0bd22e64b7bc',
78+
'ce0480a1-5ef1-4c3e-9861-3743b5610795'
79+
]
80+
}, {
81+
'label': {
82+
'nature': 'End User',
83+
'party': 'Exclusion'
9484
},
95-
{
96-
'label': 'Amendments',
97-
'provenance_ids': []
98-
}
99-
]
85+
'provenance_ids': [
86+
'85f5981a-ba91-44f5-9efa-0bd22e64b7bc',
87+
'ce0480a1-5ef1-4c3e-9861-3743b5610795'
88+
]
89+
}],
90+
'categories': [{
91+
'label': 'Responsibilities',
92+
'provenance_ids': []
93+
}, {
94+
'label': 'Amendments',
95+
'provenance_ids': []
96+
}]
10097
},
10198
'updated_labels': {
102-
'types': [
103-
{
104-
'label': {
105-
'nature': 'Obligation',
106-
'party': 'IBM'
107-
}
108-
},
109-
{
110-
'label': {
111-
'nature': 'Disclaimer',
112-
'party': 'Buyer'
113-
}
99+
'types': [{
100+
'label': {
101+
'nature': 'Obligation',
102+
'party': 'IBM'
114103
}
115-
],
116-
'categories': [
117-
{
118-
'label': 'Responsibilities'
119-
},
120-
{
121-
'label': 'Audits'
104+
}, {
105+
'label': {
106+
'nature': 'Disclaimer',
107+
'party': 'Buyer'
122108
}
123-
]
109+
}],
110+
'categories': [{
111+
'label': 'Responsibilities'
112+
}, {
113+
'label': 'Audits'
114+
}]
124115
}
125116
}
126117

127118
add_feedback = self.compare_comply.add_feedback(
128-
feedback_data,
129-
user_id='wonder woman',
119+
feedback_data, user_id='wonder woman',
130120
comment='test commment').get_result()
131121
assert add_feedback is not None
132122
assert add_feedback['feedback_id'] is not None
133123
feedback_id = add_feedback['feedback_id']
134124

135-
self.compare_comply.set_default_headers({'x-watson-metadata': 'customer_id=sdk-test-customer-id'})
136-
get_feedback = self.compare_comply.get_feedback(feedback_id).get_result()
125+
self.compare_comply.set_default_headers(
126+
{'x-watson-metadata': 'customer_id=sdk-test-customer-id'})
127+
get_feedback = self.compare_comply.get_feedback(
128+
feedback_id).get_result()
137129
assert get_feedback is not None
138130

139131
list_feedback = self.compare_comply.list_feedback(
140132
feedback_type='element_classification').get_result()
141133
assert list_feedback is not None
142134

143-
delete_feedback = self.compare_comply.delete_feedback(feedback_id).get_result()
135+
delete_feedback = self.compare_comply.delete_feedback(
136+
feedback_id).get_result()
144137
assert delete_feedback is not None
145138

146139
@pytest.mark.skip(reason="Temporarily skip")
@@ -151,12 +144,9 @@ def test_batches(self):
151144
with open(os.path.join(os.path.dirname(__file__), '../../resources/cloud-object-storage-credentials-input.json'), 'rb') as input_credentials_file, \
152145
open(os.path.join(os.path.dirname(__file__), '../../resources/cloud-object-storage-credentials-output.json'), 'rb') as output_credentials_file:
153146
create_batch = self.compare_comply.create_batch(
154-
'html_conversion',
155-
input_credentials_file,
156-
'us-south',
147+
'html_conversion', input_credentials_file, 'us-south',
157148
'compare-comply-integration-test-bucket-input',
158-
output_credentials_file,
159-
'us-south',
149+
output_credentials_file, 'us-south',
160150
'compare-comply-integration-test-bucket-output').get_result()
161151

162152
assert create_batch is not None

0 commit comments

Comments
 (0)