# Path: haystack/argparse_utils.py
# def readable(f):
# def writeable(f):
# def int16(s):


import logging
import unittest
import sys
import argparse
from haystack import argparse_utils


class Test(unittest.TestCase):

    def test_readable(self):
        """test the readable helper."""
        invalid = '/345678ui0d9t921giv9'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.readable, invalid)

        valid = sys.modules[__name__].__file__
        self.assertEqual(argparse_utils.readable(valid), valid)
        return

    def test_writeable(self):
        """test the writeable helper."""
        invalid = '/345678ui0d9t921giv9/qwf89/2/4r/ef/23/23g/'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.writeable, invalid)

        valid = sys.modules[__name__].__file__
        self.assertEqual(argparse_utils.writeable(valid), valid)
        return

    def test_int16(self):
        """test the int16 helper."""
        invalid = '/345678ui0d9t921giv9'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.int16, invalid)
        invalid = sys.modules[__name__].__file__
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.int16, invalid)

        valid = '0x01293'

# Path: haystack/argparse_utils.py
# def readable(f):
# def writeable(f):
# def int16(s):


# Path: test/haystack/test_argparse_utils.py
import logging
import unittest
import sys
import argparse
from haystack import argparse_utils



class Test(unittest.TestCase):

    def test_readable(self):
        """test the readable helper."""
        invalid = '/345678ui0d9t921giv9'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.readable, invalid)

        valid = sys.modules[__name__].__file__
        self.assertEqual(argparse_utils.readable(valid), valid)
        return

    def test_writeable(self):
        """test the writeable helper."""
        invalid = '/345678ui0d9t921giv9/qwf89/2/4r/ef/23/23g/'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.writeable, invalid)

        valid = sys.modules[__name__].__file__
        self.assertEqual(argparse_utils.writeable(valid), valid)
        return

    def test_int16(self):
        """test the int16 helper."""
        invalid = '/345678ui0d9t921giv9'
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.int16, invalid)
        invalid = sys.modules[__name__].__file__
        self.assertRaises(argparse.ArgumentTypeError, argparse_utils.int16, invalid)

        valid = '0x01293'

        self.assertEqual(argparse_utils.int16(valid), 0x01293)