Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ilp_keyboard_layout_optimization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Björn Ludwig
ilp_keyboard_layout_optimization
Merge requests
!1
Introduce Chars
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Introduce Chars
introduce_chars
into
main
Overview
0
Commits
22
Pipelines
0
Changes
1
Merged
Björn Ludwig
requested to merge
introduce_chars
into
main
3 years ago
Overview
0
Commits
22
Pipelines
0
Changes
1
Expand
This improves the implementation by introducing a class to manage the characters
0
0
Merge request reports
Viewing commit
ff8011de
Prev
Next
Show latest version
1 file
+
65
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Unverified
ff8011de
wip(chars): introduce tests for new module and class Chars
· ff8011de
Björn Ludwig
authored
3 years ago
test/test_chars.py
0 → 100644
+
65
−
0
Options
from
typing
import
Iterable
,
List
from
hypothesis
import
given
,
settings
,
strategies
as
hst
from
src.ilp_keyboard_layout_optimization.data_aquisition.chars
import
(
Chars
,
)
from
src.ilp_keyboard_layout_optimization.type_aliases
import
CharTuple
def
test_chars_init
():
assert
Chars
()
def
test_chars_chars_type
():
assert
isinstance
(
Chars
().
chars
,
str
)
def
test_chars_char_tuple_type
():
assert
isinstance
(
Chars
().
char_tuple
,
CharTuple
.
__origin__
)
@given
(
hst
.
tuples
(
hst
.
text
(
min_size
=
1
)))
@settings
(
deadline
=
None
)
# TODO Fix this test, it is not generating what it is supposed to
def
test_chars_input_tuple
(
char_tuple
):
assert
Chars
(
char_tuple
).
chars
==
""
.
join
(
char_tuple
)
@given
(
hst
.
text
(
min_size
=
1
))
def
test_chars_input_str
(
char_string
):
assert
Chars
(
char_string
).
chars
==
char_string
@given
(
hst
.
text
(
min_size
=
1
))
def
test_chars_input_tuple_equals_input_str
(
char_string
):
char_tuple
=
Chars
.
_str2char_tuple
(
char_string
)
assert
Chars
(
char_string
).
chars
==
Chars
(
char_tuple
).
chars
@given
(
hst
.
text
(
min_size
=
1
))
def
test_chars_input_str
(
char_string
):
assert
Chars
(
char_string
).
chars
==
char_string
def
test_chars_default
():
all_test_chars
=
list
(
Chars
().
chars
)
basic_latin
=
_get_unicode_chars
(
range
(
0x0021
,
0x007F
))
latin_1_supp
=
_get_unicode_chars
(
(
0x00C4
,
0x00D6
,
0x00DC
,
0x00E4
,
0x00F6
,
0x00FC
,
0x00DF
)
)
general_punc
=
_get_unicode_chars
((
0x2013
,
0x2026
))
extended_alphabet
=
basic_latin
+
latin_1_supp
+
general_punc
for
char
in
extended_alphabet
:
all_test_chars
.
remove
(
char
)
assert
not
all_test_chars
def
_get_unicode_chars
(
code_point_range
:
Iterable
)
->
List
[
str
]:
return
[
chr
(
char
)
for
char
in
code_point_range
]
@given
(
hst
.
text
(
min_size
=
1
))
def
test_chars_monograms
(
char_string
):
pass
Loading