-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Convert docs_generate_tests to new framework #5058
Changes from 1 commit
f1a9958
5321aa1
abbdf37
5a0fdec
afcfcbb
de28f8c
67b712b
a37509a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,12 @@ | |
# get_relation_columns | ||
# update_rows | ||
# generate_update_clause | ||
|
||
# | ||
# Classes for comparing fields in dictionaries | ||
# AnyFloat | ||
# AnyInteger | ||
# AnyString | ||
# AnyStringWith | ||
# ============================================================================= | ||
|
||
|
||
|
@@ -430,3 +435,46 @@ def check_table_does_not_exist(adapter, name): | |
def check_table_does_exist(adapter, name): | ||
columns = get_relation_columns(adapter, name) | ||
assert len(columns) > 0 | ||
|
||
|
||
# Utility classes for enabling comparison of dictionaries | ||
|
||
|
||
class AnyFloat: | ||
"""Any float. Use this in assert calls""" | ||
|
||
def __eq__(self, other): | ||
return isinstance(other, float) | ||
|
||
|
||
class AnyInteger: | ||
"""Any Integer. Use this in assert calls""" | ||
|
||
def __eq__(self, other): | ||
return isinstance(other, int) | ||
|
||
|
||
class AnyString: | ||
"""Any string. Use this in assert calls""" | ||
|
||
def __eq__(self, other): | ||
return isinstance(other, str) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The three classes here looks very similar, why we are doing it as 3 individual instead of having one that you can maybe pass in a specific type? Also, think we can achieve There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They're separate classes because they were copied from existing classes in the integration test suite. You do have a point that a single class that takes a type would work here. |
||
|
||
|
||
class AnyStringWith: | ||
"""AnyStringWith("AUTO")""" | ||
|
||
def __init__(self, contains=None): | ||
self.contains = contains | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, str): | ||
return False | ||
|
||
if self.contains is None: | ||
return True | ||
|
||
return self.contains in other | ||
|
||
def __repr__(self): | ||
return "AnyStringWith<{!r}>".format(self.contains) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which adapter need this change and why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a way to get the "owner" in the catalog. It's different for different adapters. Some of them use the "user" in the profile, some use other things. So this is special fixture to help with that. We didn't have a standard way to get the profile's user before.