Skip to content

tests: fix macos test #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,3 @@ docs = [
examples = [
"notebook",
]
[tool.pytest.ini_options]
pythonpath = [
"src"]
21 changes: 12 additions & 9 deletions src/pygccxml/declarations/container_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@

std_namespaces = ('std', 'stdext', '__gnu_cxx')

# Take into account different equivalences (with or without spaces)
string_equivalences = type_traits.string_equivalences + \
type_traits.normalized_string_equivalences
string_equivalences = [
v for v in string_equivalences if not v == "std::string"]
wstring_equivalences = type_traits.wstring_equivalences + \
type_traits.normalized_wstring_equivalences
wstring_equivalences = [
v for v in wstring_equivalences if not v == "std::wstring"]


class defaults_eraser(object):

Expand All @@ -29,16 +39,9 @@ def normalize(self, type_str):
return type_str.replace(' ', '')

def replace_basic_string(self, cls_name):
# Replace all the variations of strings by the smallest one.
strings = {
"std::string":
[v for v in
type_traits.normalized_string_equivalences
if not v == "std::string"],
"std::wstring":
[v for v in
type_traits.normalized_wstring_equivalences
if not v == "std::wstring"]
"std::string": string_equivalences,
"std::wstring": wstring_equivalences
}

new_name = cls_name
Expand Down
24 changes: 14 additions & 10 deletions src/pygccxml/declarations/type_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,29 +490,33 @@ def _normalize_equivalences(equivalences):

string_equivalences = [
(
'::std::basic_string<char, std::char_traits<char>, '
'std::basic_string<char, std::char_traits<char>, '
'std::allocator<char>>'
),
'::std::basic_string<char>',
'::std::string'
'std::basic_string<char>',
'std::string'
]

wstring_equivalences = [
(
'::std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::basic_string<wchar_t, std::char_traits<wchar_t>, '
'std::allocator<wchar_t>>'
),
'::std::basic_string<wchar_t>',
'::std::wstring'
'std::basic_string<wchar_t>',
'std::wstring'
]

ostream_equivalences = [
'::std::basic_ostream<char, std::char_traits<char>>',
'::std::basic_ostream<char>', '::std::ostream']
'std::basic_ostream<char, std::char_traits<char>>',
'std::basic_ostream<char>',
'std::ostream'
]

wostream_equivalences = [
'::std::basic_ostream<wchar_t, std::char_traits<wchar_t>>',
'::std::basic_ostream<wchar_t>', '::std::wostream']
'std::basic_ostream<wchar_t, std::char_traits<wchar_t>>',
'std::basic_ostream<wchar_t>',
'std::wostream'
]


normalized_string_equivalences = _normalize_equivalences(
Expand Down
Loading