File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
sdk/textanalytics/azure-ai-textanalytics Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ def __ne__(self, other):
4343 """Compare objects by comparing all attributes."""
4444 return not self .__eq__ (other )
4545
46+ def __contains__ (self , key ):
47+ return key in self .__dict__
48+
4649 def __str__ (self ):
4750 return str ({k : v for k , v in self .__dict__ .items () if not k .startswith ('_' )})
4851
Original file line number Diff line number Diff line change 1+ # coding=utf-8
2+ # ------------------------------------
3+ # Copyright (c) Microsoft Corporation.
4+ # Licensed under the MIT License.
5+ # ------------------------------------
6+
7+ import pytest
8+ from azure .ai .textanalytics import _models
9+
10+
11+ class TestDictMixin :
12+
13+ def test_contains (self ):
14+ model = _models .DictMixin ()
15+ key = "name"
16+ value = "steve"
17+ model .__setitem__ (key , value )
18+ assert model .__contains__ (key )
You can’t perform that action at this time.
0 commit comments