diff options
| author | Kenneth Reitz <me@kennethreitz.com> | 2010-09-25 18:09:44 -0400 |
|---|---|---|
| committer | Kenneth Reitz <me@kennethreitz.com> | 2010-10-01 17:52:08 -0400 |
| commit | 187d12cffc5cb3b46f0ce6333cf0f5f407d3a949 (patch) | |
| tree | 20a2ed2d7c8f2737f18ba150e711b75c5d9d4c3b /test_tablib.py | |
| parent | eaa4de779391d9cbfc970cd418ccb36efdde122e (diff) | |
| download | tablib-187d12cffc5cb3b46f0ce6333cf0f5f407d3a949.tar.gz | |
Format Auto-detection in place.
Test suite updated.
Diffstat (limited to 'test_tablib.py')
| -rwxr-xr-x | test_tablib.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test_tablib.py b/test_tablib.py index 3f8ee37..4843117 100755 --- a/test_tablib.py +++ b/test_tablib.py @@ -307,6 +307,21 @@ class TablibTestCase(unittest.TestCase): self.assertFalse(tablib.formats.yaml.detect(_bunk)) + def test_auto_format_detect(self): + """Test auto format detection.""" + + _yaml = '- {age: 90, first_name: John, last_name: Adams}' + _json = '[{"last_name": "Adams","age": 90,"first_name": "John"}]' + _csv = '1,2,3\n4,5,6\n7,8,9\n' + _bunk = '¡¡¡¡¡¡---///\n\n\n¡¡£™∞¢£§∞§¶•¶ª∞¶•ªº••ª–º§•†•§º¶•†¥ª–º•§ƒø¥¨©πƒø†ˆ¥ç©¨√øˆ¥≈†ƒ¥ç©ø¨çˆ¥ƒçø¶' + + self.assertEqual(tablib.detect(_yaml)[0], tablib.formats.yaml) + self.assertEqual(tablib.detect(_csv)[0], tablib.formats.csv) + self.assertEqual(tablib.detect(_json)[0], tablib.formats.json) + self.assertEqual(tablib.detect(_bunk)[0], None) + + + def test_wipe(self): """Purge a dataset.""" |
