Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
simplified tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Mar 30, 2016
1 parent 9e79fa4 commit b9e4553
Show file tree
Hide file tree
Showing 23 changed files with 119 additions and 187 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

import os
import unittest
from importlib import import_module
module = import_module('tabulator.loaders.file')

from tabulator import loaders


class TestFile(unittest.TestCase):

# Actions

def setUp(self):
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
basedir = os.path.join(os.path.dirname(__file__), '..', '..')
self.source = os.path.join(basedir, 'data', 'table.csv')
self.encoding = 'utf-8'
self.loader = module.FileLoader(self.source, self.encoding)
self.loader = loaders.File(self.source, self.encoding)

# Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.loaders.text')

from tabulator import loaders


class TestText(unittest.TestCase):
Expand All @@ -16,7 +16,7 @@ class TestText(unittest.TestCase):
def setUp(self):
self.source = 'id,name\n1,english\n2,中国人\n'
self.encoding = 'utf-8'
self.loader = module.TextLoader(self.source, self.encoding)
self.loader = loaders.Text(self.source, self.encoding)

# Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.loaders.web')

from tabulator import loaders


class TestWeb(unittest.TestCase):
Expand All @@ -18,7 +18,7 @@ def setUp(self):
baseurl += '/okfn/tabulator-py/master/data'
self.source = baseurl + '/table.csv'
self.encoding = 'utf-8'
self.loader = module.WebLoader(self.source, self.encoding)
self.loader = loaders.Web(self.source, self.encoding)

# Tests

Expand Down
Empty file.
72 changes: 0 additions & 72 deletions tests/module/test_helpers.py

This file was deleted.

68 changes: 0 additions & 68 deletions tests/module/test_topen.py

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import os
import unittest
from mock import Mock
from importlib import import_module
module = import_module('tabulator.parsers.csv')

from tabulator import parsers


class TestCSV(unittest.TestCase):

# Actions

def setUp(self):
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
basedir = os.path.join(os.path.dirname(__file__), '..', '..')
self.source = os.path.join(basedir, 'data', 'table.csv')
self.loader = Mock()
self.loader.load = Mock(return_value=io.open(self.source))
self.parser = module.CSVParser()
self.parser = parsers.CSV()

# Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import os
import unittest
from mock import Mock
from importlib import import_module
module = import_module('tabulator.parsers.excel')

from tabulator import parsers


class TestExcel(unittest.TestCase):

# Actions

def setUp(self):
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
basedir = os.path.join(os.path.dirname(__file__), '..', '..')
self.source = os.path.join(basedir, 'data', 'table.xls')
self.loader = Mock()
self.loader.load = Mock(return_value=io.open(self.source, 'rb'))
self.parser = module.ExcelParser()
self.parser = parsers.Excel()

# Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import os
import unittest
from mock import Mock
from importlib import import_module
module = import_module('tabulator.parsers.excelx')

from tabulator import parsers


class TestExcelx(unittest.TestCase):

# Actions

def setUp(self):
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
basedir = os.path.join(os.path.dirname(__file__), '..', '..')
self.source = os.path.join(basedir, 'data', 'table.xlsx')
self.loader = Mock()
self.loader.load = Mock(return_value=io.open(self.source, 'rb'))
self.parser = module.ExcelxParser()
self.parser = parsers.Excelx()

# Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import os
import unittest
from mock import Mock
from importlib import import_module
module = import_module('tabulator.parsers.json')

from tabulator import parsers


class TestJSON(unittest.TestCase):

# Actions

def setUp(self):
basedir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
basedir = os.path.join(os.path.dirname(__file__), '..', '..')
self.source = os.path.join(basedir, 'data', 'table-dicts.json')
self.loader = Mock()
self.loader.load = Mock(return_value=io.open(self.source, 'rb'))
self.parser = module.JSONParser()
self.parser = parsers.JSON()

# Tests

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.processors.headers')

from tabulator import processors


class TestHeaders(unittest.TestCase):

# Tests

def test(self):
self.assertTrue(module.HeadersProcessor)
self.assertTrue(processors.Headers)
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.processors.schema')

from tabulator import processors


class TestSchema(unittest.TestCase):

# Tests

def test(self):
self.assertTrue(module.SchemaProcessor)
self.assertTrue(processors.Schema)
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.processors.strict')

from tabulator import processors


class TestStrict(unittest.TestCase):

# Tests

def test(self):
self.assertTrue(module.StrictProcessor)
self.assertTrue(processors.Strict)
Empty file removed tests/system/__init__.py
Empty file.
6 changes: 3 additions & 3 deletions tests/module/test_errors.py → tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from __future__ import unicode_literals

import unittest
from importlib import import_module
module = import_module('tabulator.errors')

from tabulator import errors


class Test_errors(unittest.TestCase):

# Tests

def test(self):
self.assertTrue(issubclass(module.Error, Exception))
self.assertTrue(issubclass(errors.Error, Exception))
Loading

0 comments on commit b9e4553

Please sign in to comment.