Passed
Pull Request — master (#3)
by Yang
04:58
created

test_CreateSubjectCheckExist()   B

Complexity

Conditions 8

Size

Total Lines 49
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 49
rs 7.2693
c 0
b 0
f 0
cc 8
nop 0
1
import sqlite3
0 ignored issues
show
Coding Style Naming introduced by
The name test_LocalDBQuery does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
from pathlib import Path
3
import logging
4
import os
5
import sys
6
from LocalDB.query import LocalDB_query
0 ignored issues
show
Bug introduced by
The name query does not seem to exist in module LocalDB.
Loading history...
introduced by
Unable to import 'LocalDB.query'
Loading history...
7
from LocalDB.create_CNBP import LocalDB_createCNBP
0 ignored issues
show
Bug introduced by
The name create_CNBP does not seem to exist in module LocalDB.
Loading history...
introduced by
Unable to import 'LocalDB.create_CNBP'
Loading history...
8
from dotenv import load_dotenv
9
import unittest
0 ignored issues
show
introduced by
standard import "import unittest" should be placed before "from LocalDB.query import LocalDB_query"
Loading history...
10
11
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
12
13
14
class UT_LocalDBCreate(unittest.TestCase):
0 ignored issues
show
Coding Style Naming introduced by
The name UT_LocalDBCreate does not conform to the class naming conventions ([A-Z_][a-zA-Z0-9]+$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
15
16
    @staticmethod
17
    def test_CreateSubject():
0 ignored issues
show
Coding Style Naming introduced by
The name test_CreateSubject does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
18
        logger = logging.getLogger('UT_CreateSubject')
19
        PathString = "TestCNBPQuery.sqlite"
0 ignored issues
show
Coding Style Naming introduced by
The name PathString does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
20
21
        # if SQL already exist, quit script.
22
        SQLPath = Path(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name SQLPath does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
23
24
        # check if path is a file and exist.
25
        if SQLPath.is_file():
26
            logger.info('Test SQLite database file already exist. Gonna mess with it!')
27
            ''''Delete current database! During testing only'''
0 ignored issues
show
Unused Code introduced by
This string statement has no effect and could be removed.
Loading history...
28
            os.remove(PathString)
29
30
        # Create the database
31
        assert LocalDB_createCNBP.database(PathString)
32
        logger.info('Test SQLite database successfully created. Gonna mess with it!')
33
34
        tableName = 'id_table'  # All CNBP database should have this table name.
0 ignored issues
show
Coding Style Naming introduced by
The name tableName does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
35
        MRNColumn = "MRN"
0 ignored issues
show
Coding Style Naming introduced by
The name MRNColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
36
        CNBPIDColumn = "CNBPID"
0 ignored issues
show
Coding Style Naming introduced by
The name CNBPIDColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The variable CNBPIDColumn seems to be unused.
Loading history...
37
38
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 291033)
39
        logger.info('Test SQLite database successfully inserted with mock records. Gonna check!')
40
41
        # Populate the table with some fake records.
42
        ConnectedDatabase = sqlite3.connect(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name ConnectedDatabase does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
43
        c = ConnectedDatabase.cursor()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
44
        c.execute(
45
            'SELECT * FROM {tablename} WHERE {columnname}="{columnvalue}"'.
46
                format(tablename=tableName, columnname=MRNColumn,columnvalue=291033))
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (remove 4 spaces).
Loading history...
Coding Style introduced by
Exactly one space required after comma
Loading history...
47
        ResultRows = c.fetchall()
0 ignored issues
show
Coding Style Naming introduced by
The name ResultRows does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
48
49
        assert len(ResultRows) > 0
0 ignored issues
show
Unused Code introduced by
Do not use len(SEQUENCE) as condition value
Loading history...
50
51
        # Closing the connection to the database file
52
        ConnectedDatabase.close()
53
54
        # Remove test data base created
55
        os.remove(PathString)
56
57
        return True
58
59
    @staticmethod
60
    def test_CheckSubjectExist():
0 ignored issues
show
Coding Style Naming introduced by
The name test_CheckSubjectExist does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
61
        logger = logging.getLogger('UT_CheckSubjectExist')
62
        PathString = "TestCNBPQuery.sqlite"
0 ignored issues
show
Coding Style Naming introduced by
The name PathString does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
63
64
        # if SQL already exist, quit script.
65
        SQLPath = Path(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name SQLPath does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
66
67
        # check if path is a file and exist.
68
        if SQLPath.is_file():
69
            logger.info('Test SQLite database file already exist. Gonna mess with it!')
70
            ''''Delete current database! During testing only'''
0 ignored issues
show
Unused Code introduced by
This string statement has no effect and could be removed.
Loading history...
71
            os.remove(PathString)
72
73
        # Create the database
74
        assert LocalDB_createCNBP.database(PathString)
75
        logger.info('Test SQLite database successfully created. Gonna mess with it!')
76
77
        tableName = 'id_table'  # All CNBP database should have this table name.
0 ignored issues
show
Coding Style Naming introduced by
The name tableName does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
78
        MRNColumn = "MRN"
0 ignored issues
show
Coding Style Naming introduced by
The name MRNColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
79
        CNBPIDColumn = "CNBPID"
0 ignored issues
show
Coding Style Naming introduced by
The name CNBPIDColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
80
81
        # Populate the table with some fake records.
82
        ConnectedDatabase = sqlite3.connect(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name ConnectedDatabase does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
83
        c = ConnectedDatabase.cursor()
0 ignored issues
show
Coding Style Naming introduced by
The name c does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
84
        c.execute("INSERT INTO {tn} ({mrn},{cnbpid}) VALUES (291010,'CNBP0010001')".
85
                  format(tn=tableName, mrn=MRNColumn, cnbpid=CNBPIDColumn))
86
        c.execute("INSERT INTO {tn} ({mrn},{cnbpid}) VALUES (292010,'CNBP0020001')".
87
                  format(tn=tableName, mrn=MRNColumn, cnbpid=CNBPIDColumn))
88
        c.execute("INSERT INTO {tn} ({mrn},{cnbpid}) VALUES (295010,'CNBP0010001')".
89
                  format(tn=tableName, mrn=MRNColumn, cnbpid=CNBPIDColumn))
90
        c.execute("INSERT INTO {tn} ({mrn},{cnbpid}) VALUES (297120,'CNBP0030001')".
91
                  format(tn=tableName, mrn=MRNColumn, cnbpid=CNBPIDColumn))
92
        c.execute("INSERT INTO {tn} ({mrn},{cnbpid}) VALUES (291310,'CNBP0510001')".
93
                  format(tn=tableName, mrn=MRNColumn, cnbpid=CNBPIDColumn))
94
        ConnectedDatabase.commit()
95
        ConnectedDatabase.close()
96
97
        logger.info('Test SQLite database successfully inserted with mock records. Gonna mess with it!')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (104/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
98
99
        # Create on Connecting to the database file
100
        assert(LocalDB_query.check_value(PathString, tableName, "MRN", 291010))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
101
        assert(LocalDB_query.check_value(PathString, tableName, "CNBPID", "CNBP0010001"))
0 ignored issues
show
Unused Code Coding Style introduced by
There is an unnecessary parenthesis after assert.
Loading history...
102
103
        # Remove test data base created
104
        os.remove(PathString)
105
106
        return True
107
108
    @staticmethod
109
    def test_CreateSubjectCheckExist():
0 ignored issues
show
Coding Style Naming introduced by
The name test_CreateSubjectCheckExist does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
110
        logger = logging.getLogger('UT_CreateAndCheck')
111
        PathString = "TestCNBPQuery.sqlite"
0 ignored issues
show
Coding Style Naming introduced by
The name PathString does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
112
113
        # if SQL already exist, quit script.
114
        SQLPath = Path(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name SQLPath does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
115
116
        # check if path is a file and exist.
117
        if SQLPath.is_file():
118
            logger.info('Test SQLite database file already exist. Gonna mess with it!')
119
            ''''Delete current database! During testing only'''
0 ignored issues
show
Unused Code introduced by
This string statement has no effect and could be removed.
Loading history...
120
            os.remove(PathString)
121
122
        # Create the database
123
        assert LocalDB_createCNBP.database(PathString)
124
        logger.info('Test SQLite database successfully created. Gonna mess with it!')
125
126
        tableName = 'id_table'  # All CNBP database should have this table name.
0 ignored issues
show
Coding Style Naming introduced by
The name tableName does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
127
        MRNColumn = "MRN"
0 ignored issues
show
Coding Style Naming introduced by
The name MRNColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
128
        CNBPIDColumn = "CNBPID"
0 ignored issues
show
Coding Style Naming introduced by
The name CNBPIDColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Unused Code introduced by
The variable CNBPIDColumn seems to be unused.
Loading history...
129
130
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 2918210)
131
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 23452346)
132
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 2345234)
133
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 273411)
134
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 364573)
135
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 7424141)
136
137
        success, _ = LocalDB_query.check_value(PathString, tableName, MRNColumn, 7129112)
138
        assert not success
139
140
        success, _ = LocalDB_query.check_value(PathString, tableName, MRNColumn, 2918210)
141
        assert success
142
143
        success, _ = LocalDB_query.check_value(PathString, tableName, MRNColumn, 712921)
144
        assert not success
145
146
        success, _ = LocalDB_query.check_value(PathString, tableName, MRNColumn, 742)
147
        assert not success
148
149
        success, _ = LocalDB_query.check_value(PathString, tableName, MRNColumn, 364573)
150
        assert success
151
152
        logger.info('Tested SQLIte database entry. ')
153
154
        # Remove test data base created
155
        os.remove(PathString)
156
157
        return True
158
159
    @staticmethod
160
    def test_SubjectUpdate():
0 ignored issues
show
Coding Style Naming introduced by
The name test_SubjectUpdate does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
161
        logger = logging.getLogger('UT_CreateAndCheck')
162
        PathString = "TestCNBPQuery.sqlite"
0 ignored issues
show
Coding Style Naming introduced by
The name PathString does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
163
164
        # if SQL already exist, quit script.
165
        SQLPath = Path(PathString)
0 ignored issues
show
Coding Style Naming introduced by
The name SQLPath does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
166
167
        # check if path is a file and exist.
168
        if SQLPath.is_file():
169
            logger.info('Test SQLite database file already exist. Gonna mess with it!')
170
            ''''Delete current database! During testing only'''
0 ignored issues
show
Unused Code introduced by
This string statement has no effect and could be removed.
Loading history...
171
            os.remove(PathString)
172
173
        # Create the database
174
        assert LocalDB_createCNBP.database(PathString)
175
        logger.info('Test SQLite database successfully created. Gonna mess with it!')
176
177
        tableName = 'id_table'  # All CNBP database should have this table name.
0 ignored issues
show
Coding Style Naming introduced by
The name tableName does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
178
        MRNColumn = "MRN"
0 ignored issues
show
Coding Style Naming introduced by
The name MRNColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
179
        CNBPIDColumn = "CNBPID"
0 ignored issues
show
Coding Style Naming introduced by
The name CNBPIDColumn does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
180
181
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 2918210)
182
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 23452346)
183
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 2345234)
184
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 273411)
185
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 364573)
186
        LocalDB_query.create_entry(PathString, tableName, MRNColumn, 7424141)
187
188
        success = load_dotenv()
189
        if not success:
190
            raise ImportError("Credential .env NOT FOUND! Please ensure .env is set with all the necessary credentials!")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (121/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
191
192
        Prefix = os.getenv("institutionID")
0 ignored issues
show
Coding Style Naming introduced by
The name Prefix does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
193
194
        LocalDB_query.update_entry(PathString, tableName, MRNColumn, 7424141, CNBPIDColumn, Prefix + "0010001")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
195
        LocalDB_query.update_entry(PathString, tableName, MRNColumn, 2345234, CNBPIDColumn, Prefix + "0010002")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
196
        LocalDB_query.update_entry(PathString, tableName, MRNColumn, 2918210, CNBPIDColumn, Prefix + "0010003")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
197
        LocalDB_query.update_entry(PathString, tableName, MRNColumn, 273411, CNBPIDColumn, Prefix + "0010004")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (110/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
198
199
        success, _ = LocalDB_query.check_value(PathString, tableName, CNBPIDColumn, 'CNBPID0010006')
200
        assert not success
201
202
        success, _ = LocalDB_query.check_value(PathString, tableName, CNBPIDColumn, Prefix + "0010001")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (103/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
203
        assert success
204
205
        success, _ = LocalDB_query.check_value(PathString, tableName, CNBPIDColumn, 55555)
206
        assert not success
207
208
        success, _ = LocalDB_query.check_value(PathString, tableName, CNBPIDColumn, 742)
209
        assert not success
210
211
        success, _ = LocalDB_query.check_value(PathString, tableName, CNBPIDColumn, Prefix + "0010003")
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (103/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
212
        assert success
213
214
        logger.info('Tested SQLIte database entry. ')
215
216
        # Remove test data base created
217
        os.remove(PathString)
218
219
        return True
220
221
if __name__ == '__main__':
222
    UT_LocalDBCreate.test_SubjectUpdate()
0 ignored issues
show
Coding Style introduced by
Final newline missing
Loading history...