File: test_emptyfile.py

package info (click to toggle)
python-skbio 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 16,556 kB
  • ctags: 7,222
  • sloc: python: 42,085; ansic: 670; makefile: 180; sh: 10
file content (36 lines) | stat: -rw-r--r-- 1,097 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------------------------------------------------------------

import unittest
import io

from skbio.io.format.emptyfile import _empty_file_sniffer


class TestEmptyFile(unittest.TestCase):
    def test_empty(self):
        res, kw = _empty_file_sniffer(io.StringIO())
        self.assertTrue(res)
        self.assertEqual({}, kw)

        res, kw = _empty_file_sniffer(io.StringIO("       \n   \t "))
        self.assertTrue(res)
        self.assertEqual({}, kw)

    def test_not_empty(self):
        res, kw = _empty_file_sniffer(io.StringIO("a"))
        self.assertFalse(res)
        self.assertEqual({}, kw)

        res, kw = _empty_file_sniffer(io.StringIO("                  \n \ta"))
        self.assertFalse(res)
        self.assertEqual({}, kw)


if __name__ == '__main__':
    unittest.main()