-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for objects embedding
- Loading branch information
Showing
5 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import re | ||
|
||
|
||
# Function verifying an email is valid | ||
def verify_email(email: str) -> bool: | ||
return re.match(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", email) is not None | ||
|
||
|
||
class Person: | ||
def __init__(self, name: str, age: int): | ||
self.name = name | ||
self.age = age | ||
|
||
# String representation of the class | ||
def __str__(self) -> str: | ||
return f"Person(name={self.name}, age={self.age})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# README 3 | ||
|
||
This is a test README file for testing the code embedding process. | ||
|
||
## Python objects | ||
|
||
This section contains examples of Python objects. | ||
|
||
```python:tests/data/example_python_objects.py:verify_email | ||
def verify_email(email: str) -> bool: | ||
return re.match(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$", email) is not None | ||
``` | ||
|
||
```python:tests/data/example_python_objects.py:Person | ||
class Person: | ||
def __init__(self, name: str, age: int): | ||
self.name = name | ||
self.age = age | ||
# String representation of the class | ||
def __str__(self) -> str: | ||
return f"Person(name={self.name}, age={self.age})" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# README 3 | ||
|
||
This is a test README file for testing the code embedding process. | ||
|
||
## Python objects | ||
|
||
This section contains examples of Python objects. | ||
|
||
```python:tests/data/example_python_objects.py:verify_email | ||
``` | ||
|
||
```python:tests/data/example_python_objects.py:Person | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters