Skip to content

Commit f2e31cb

Browse files
Merge branch 'fixing-tests'
2 parents b1e2847 + d9b6d34 commit f2e31cb

5 files changed

Lines changed: 75 additions & 12 deletions

File tree

.github/workflows/branch.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Branch
22

33
on:
4-
pull_request:
4+
push:
5+
branches-ignore:
6+
- [master, main]
57

68
concurrency:
79
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

.github/workflows/pull-request.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Branch
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
12+
support-matrix:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set-matrix.outputs.matrix }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
- id: set-matrix
19+
run: echo "::set-output name=matrix::$(python cicd-matrix.py)"
20+
21+
coverage-artifact-name:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
ref: ${{ steps.get-ref.outputs.ref }}
25+
steps:
26+
- id: get-ref
27+
run: |
28+
ref=${{ github.ref }}
29+
echo "::set-output name=ref::${ref////-}"
30+
31+
run-tests:
32+
needs: [ support-matrix, coverage-artifact-name ]
33+
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
os: ${{ fromJson(needs.support-matrix.outputs.matrix).os }}
39+
python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions/setup-python@v2
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
- uses: actions/cache@v2
46+
with:
47+
path: ${{ env.pythonLocation }}
48+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
49+
- name: Install Dependencies
50+
run: |
51+
pip install --upgrade --upgrade-strategy eager -r requirements.txt -r requirements.dev.txt -e .
52+
- name: Run Tests
53+
uses: ./.github/workflows/run-tests
54+
with:
55+
coverage-artifact-name: code-coverage
56+

exatomic/core/basis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,16 @@ def spherical_by_shell(self, program, spherical=True):
119119
def functions_by_shell(self):
120120
"""Return a series of n functions per (set, L).
121121
This does not include degenerate functions."""
122-
obj = self.groupby(self._indexes)['shell'].nunique()
122+
obj = self._revert_categories(inplace=False)
123+
obj = obj.groupby(self._indexes)['shell'].nunique()
123124
obj.index.set_names(self._indexes, inplace=True)
124125
return obj
125126

126127
def primitives_by_shell(self):
127128
"""Return a series of n primitives per (set, L).
128129
This does not include degenerate primitives."""
129-
obj = self.groupby(self._indexes)['alpha'].nunique()
130+
obj = self._revert_categories(inplace=False)
131+
obj = obj.groupby(self._indexes)['alpha'].nunique()
130132
obj.index.set_names(self._indexes, inplace=True)
131133
return obj
132134

exatomic/exa/core/numerical.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ def slice_naive(self, key):
4646
key = check_key(self, key)
4747
return cls(self.loc[key])
4848

49-
def __repr__(self):
50-
name = '.'.join([self.__module__, self.__class__.__name__])
51-
return '{0}{1}'.format(name, self.shape)
52-
5349
def __str__(self):
5450
return self.__repr__()
5551

@@ -193,13 +189,20 @@ def copy(self, *args, **kwargs):
193189
cls = self.__class__ # Note that type conversion does not perform copy
194190
return cls(pd.DataFrame(self).copy(*args, **kwargs))
195191

196-
def _revert_categories(self):
192+
def _revert_categories(self, inplace=True):
197193
"""
198194
Inplace conversion to categories.
199195
"""
200-
for column, dtype in self._categories.items():
201-
if column in self.columns:
202-
self[column] = self[column].astype(dtype)
196+
if inplace:
197+
for column, dtype in self._categories.items():
198+
if column in self.columns:
199+
self[column] = self[column].astype(dtype)
200+
else:
201+
copy = self.copy()
202+
for column, dtype in copy._categories.items():
203+
if column in copy.columns:
204+
copy[column] = copy[column].astype(dtype)
205+
return copy
203206

204207
def _set_categories(self):
205208
"""

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PyYAML>=3.0
22
bokeh
33
h5py>=3.4.0
4-
ipywidgets>=7.0
4+
ipywidgets>=7.0,<8.0
55
matplotlib>=3.0
66
networkx>=2.0
77
numba>=0.50

0 commit comments

Comments
 (0)