File: test_file.py

package info (click to toggle)
python-versioneer 0.29-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 648 kB
  • sloc: python: 2,656; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 761 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
import os, tempfile, unittest
from versioneer import versions_from_file

class Parser(unittest.TestCase):
    def test_lf(self):
        with tempfile.TemporaryDirectory() as root:
            fn = os.path.join(root, "_version.py")
            with open(fn, "wb") as f:
                f.write(b"version_json = '''\n{}\n'''  # END VERSION_JSON\n")
            data = versions_from_file(fn)
            self.assertEqual(data, {})

    def test_crlf(self):
        with tempfile.TemporaryDirectory() as root:
            fn = os.path.join(root, "_version.py")
            with open(fn, "wb") as f:
                f.write(b"version_json = '''\r\n{}\r\n'''  # END VERSION_JSON\r\n")
            data = versions_from_file(fn)
            self.assertEqual(data, {})