Skip to content

Commit

Permalink
Correcting repo check and code stype check tests to fix big
Browse files Browse the repository at this point in the history
  • Loading branch information
Gchism94 committed Feb 29, 2024
1 parent 1b6a95d commit e4d3481
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions temp_code.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import math
x=2
print(x)
8 changes: 3 additions & 5 deletions tests/test_code_style_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ def test_linting_with_issues(self):

def test_linting_without_issues(self):
# Prepare a list of code blocks without style issues
# The following code block is correctly formatted
# with no style issues and includes a newline character at the end
code_blocks_without_style_issues = [
"x = 2\nprint(x)\n" # Correctly formatted code with no import statement
"import math\nx = 2\nprint(x)\n" # Properly formatted code
]
# Check style for each block
results = check_code_style(code_blocks_without_style_issues)

# Test if the linting result correctly indicates no issues
self.assertTrue(len(results) > 0, "Expected at least one linting result")
# Assuming that no issues result in an empty string or specific message
self.assertEqual(results[0].strip(), "", "Expected no style issues, but some were found in the first code block")
# Assuming that no issues result in a specific message 'No issues found.'
self.assertEqual(results[0].strip(), "No issues found.", "Expected no style issues, but some were found in the first code block")

if __name__ == '__main__':
unittest.main()
4 changes: 2 additions & 2 deletions tests/test_repo_structure_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

class TestRepoStructureCheck(unittest.TestCase):
def test_structure_check(self):
# Create a temporary directory and set up the expected structure
with tempfile.TemporaryDirectory() as tmp_dir:
# Setup: Creating required directory and allowed file
os.mkdir(os.path.join(tmp_dir, 'data'))
with open(os.path.join(tmp_dir, 'README.md'), 'w') as f:
f.write('Sample README content')
Expand All @@ -17,7 +17,7 @@ def test_structure_check(self):

# Test: Checking directory structure
required_directories = ['data']
allowed_files_patterns = ['*.md', '.gitignore'] # Adjusted to use patterns
allowed_files_patterns = ['README.md', '*.md'] # Ensure README.md is matched
result = check_directory_structure(tmp_dir, required_directories, allowed_files_patterns)

# Assertions
Expand Down

0 comments on commit e4d3481

Please sign in to comment.