コード例 #1
0
 def __init__(self,
              instance_resolver=InstanceResolver(),
              html_parser_factory=HtmlParserFactory(),
              element_factory=ElementFactory()):
     self.instance_resolver = instance_resolver
     self.html_parser_factory = html_parser_factory
     self.element_factory = element_factory
コード例 #2
0
 def __init__(self,
              file_opener=CompatibleWriteOpener(),
              object_converter=CompatibleObjectConverter(),
              variables_sorter=VariablesSorter(),
              instance_resolver=InstanceResolver(),
              csv_writer_factory=CsvWriterFactory()):
     self.file_opener = file_opener
     self.object_converter = object_converter
     self.variables_sorter = variables_sorter
     self.instance_resolver = instance_resolver
     self.csv_writer_factory = csv_writer_factory
     self.writer = None
コード例 #3
0
class TestInstanceResolver(unittest.TestCase):

    def setUp(self):
        self.type_resolver = InstanceResolver()

    def test_is_unicode_or_byte_string_argument_non_string(self):
        mock_object = mock.Mock()
        result = self.type_resolver.is_unicode_or_byte_string(mock_object)
        self.assertEquals(result, False)

    def test_is_unicode_or_byte_string_argument_string(self):
        mock_object = b"mock"
        result = self.type_resolver.is_unicode_or_byte_string(mock_object)
        self.assertEquals(result, True)

    def test_is_unicode_string_argument_non_unicode_string(self):
        mock_object = mock.Mock()
        result = self.type_resolver.is_unicode_string(mock_object)
        self.assertEquals(result, False)

    def test_is_unicode_string_argument_unicode_string(self):
        mock_object = u"mock"
        result = self.type_resolver.is_unicode_string(mock_object)
        self.assertEquals(result, True)

    def test_is_byte_string_argument_non_byte_string(self):
        mock_object = mock.Mock()
        result = self.type_resolver.is_byte_string(mock_object)
        self.assertEquals(result, False)

    def test_is_byte_string_argument_byte_string(self):
        mock_object = b"mock"
        result = self.type_resolver.is_byte_string(mock_object)
        self.assertEquals(result, True)

    def test_is_string_python_version_argument_non_string(self):
        mock_object = mock.Mock()
        result = self.type_resolver.is_string_python_version(mock_object)
        self.assertEquals(result, False)

    def test_is_string_python_version_argument_string(self):
        mock_object = "mock"
        result = self.type_resolver.is_string_python_version(mock_object)
        self.assertEquals(result, True)
コード例 #4
0
 def setUp(self):
     self.type_resolver = InstanceResolver()
コード例 #5
0
 def __init__(self,
              string_converter=StringConverter(),
              instance_resolver=InstanceResolver()):
     self.string_converter = string_converter
     self.instance_resolver = instance_resolver