<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
test_atws
----------------------------------

Tests for `atws` module.
"""


import sys
import unittest
from contextlib import contextmanager
from click.testing import CliRunner
import atws
from atws import create_picklist_module

query_test_output='''<?xml version="1.0" ?>
<queryxml>
    <entity>Ticket</entity>
    <query>
        <condition>
            <field>
                Status
                <expression op="NotEqual">5</expression>
            </field>
        </condition>
        <condition>
            <condition operator="OR">
                <field>
                    IssueType
                    <expression op="GreaterThan">345</expression>
                </field>
            </condition>
        </condition>
    </query>
</queryxml>'''


class TestAtws(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_000_zone_lookup_failure(self):
        try:
            _ = atws.connect(username='<EMAIL>',
                              password='<PASSWORD>')
        except ValueError as e:
            assert '<EMAIL> failed to resolve to a zone' in str(e) 
    
    
    def test_001_query_building_output(self):
        query = atws.Query('Ticket')
        query.WHERE('Status', query.NotEqual, 5)
        query.open_bracket()<commit_msg>query output test sample result updated to include final linesep<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
test_atws
----------------------------------

Tests for `atws` module.
"""


import sys
import unittest
from contextlib import contextmanager
from click.testing import CliRunner
import atws
from atws import create_picklist_module

query_test_output='''<?xml version="1.0" ?>
<queryxml>
    <entity>Ticket</entity>
    <query>
        <condition>
            <field>
                Status
                <expression op="NotEqual">5</expression>
            </field>
        </condition>
        <condition>
            <condition operator="OR">
                <field>
                    IssueType
                    <expression op="GreaterThan">345</expression>
                </field>
            </condition>
        </condition>
    </query>
</queryxml>
'''


class TestAtws(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_000_zone_lookup_failure(self):
        try:
            _ = atws.connect(username='<EMAIL>',
                              password='<PASSWORD>')
        except ValueError as e:
            assert '<EMAIL> failed to resolve to a zone' in str(e) 
    
    
    def test_001_query_building_output(self):
        query = atws.Query('Ticket')
        query.WHERE('Status', query.NotEqual, 5)
        query.open_bracket()
{'fraction_non_alphanumeric': 0.13555713271823988, 'fraction_numerical': 0.0099361249112846, 'mean_word_length': 1.7938553022794845, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 2, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '189075', 'n_tokens_mistral': 816, 'n_tokens_neox': 773, 'n_words': 180}