Browse Source

Minor code style formattings

tags/0.3
Johann Schmitz 3 years ago
parent
commit
4b98505bec
2 changed files with 6 additions and 3 deletions
  1. +1
    -0
      src/smartcheck/check.py
  2. +5
    -3
      tests/parsing.py

+ 1
- 0
src/smartcheck/check.py View File

@@ -28,6 +28,7 @@ DATA_ATTRIBUTES_RE = re.compile(r"\s*(\d+)\s+([\w\d_\-]+)\s+([0-9a-fx]+)\s+(\d+)

TEST_RESULT_RE = re.compile(r"#\s*(\d+)\s+(.*?)\s{2,}(.*?)\s{2,}\s+([\d%]+)\s+(\d+)\s+(\d+|-)", re.UNICODE)


def toint(s, default=0):
try:
return int(s)


+ 5
- 3
tests/parsing.py View File

@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
try:
from StringIO import StringIO
from StringIO import StringIO
except ImportError:
from io import StringIO
from io import StringIO
import os
import unittest
from smartcheck.check import SMARTCheck

samples_path = os.path.join(os.path.dirname(__file__), 'samples')


class InformationBlockParsingTest(unittest.TestCase):

def test_parsing(self):
@@ -37,7 +38,7 @@ class InformationBlockParsingTest(unittest.TestCase):
check = SMARTCheck(f)
self.assertDictEqual(check.information, expected_data)

def test_information_section_missing(self):
def test_information_section_missing_empty(self):
check = SMARTCheck(StringIO(""))
self.assertDictEqual(check.information, {})

@@ -46,6 +47,7 @@ class InformationBlockParsingTest(unittest.TestCase):
check = SMARTCheck(f)
self.assertDictEqual(check.information, {})


class SMARTDataParsingTest(unittest.TestCase):
def test_parsing(self):
for filename, overall_health, attributes in [


Loading…
Cancel
Save